www.webdeveloper.com
Results 1 to 8 of 8

Thread: Can anyone help me fix this?

  1. #1
    Join Date
    Jun 2008
    Location
    *****
    Posts
    58

    Can anyone help me fix this?

    Hi there! I have this site but am trying to make the contact form functional but I don't know how to go about it.
    Here's the link the contact page and I would like to copy this http://quanticalabs.com/Medicenter/T.../?page=contact

    Anybody out there that can help and show me how to achieve that?

    Thanks in advance

  2. #2
    Join Date
    Oct 2013
    Posts
    600
    Code:
    <form class="contact_form" id="contact_form" method="post" action="contact_form/contact_form.php">
    http://c-edgemedia.com/contact_form/contact_form.php is a zero-byte file. You need a form handling script. hotscripts.com is one source.

  3. #3
    Join Date
    Mar 2007
    Location
    localhost
    Posts
    2,500
    you need the enctype for a form to submit properly, they will be either...

    plain/text
    application/x-www-form-urlencoded
    multipart/form-data <--- this is the most likely one you want if you are submitting a form with data or a file.
    Yes, I know I'm about as subtle as being hit by a bus..(\\.\ Aug08)
    Yep... I say it like I see it, even if it is like a baseball bat in the nutz... (\\.\ Aug08)
    I want to leave this world the same way I came into it, Screaming, Incontinent & No memory!
    I laughed that hard I burst my colostomy bag... (\\.\ May03)
    Life for some is like a car accident... Mine is like a motorway pile up...

    Problems with Vista? :: Getting Cryptic wid it. :: The 'C' word! :: Whois?

  4. #4
    Join Date
    Jun 2008
    Location
    *****
    Posts
    58
    Thanks a lot but maybe I should put the source codes up so it makes it easier.

    HTML

    <form class="contact_form" id="contact_form" method="post" action="contact_form/contact_form.php">
    <fieldset class="left">
    <label>First Name</label>
    <div class="block">
    <input class="text_input" name="first_name" type="text" value="" />
    </div>

    <label>Last Name</label>
    <div class="block">
    <input class="text_input" type="text" name="last_name" value="" />
    </div>

    <label>Phone Number</label>
    <div class="block">
    <input class="text_input" name="phone_number" type="text" value="" />
    </div>

    <label>E-mail</label>
    <div class="block">
    <input class="text_input" type="text" name="email" value="" />
    </div>

    <label>Message</label>
    <div class="block">
    <textarea name="message"></textarea>
    </div>
    <input type="hidden" name="action" value="contact_form" />
    <input type="submit" name="submit" value="Send" class="more blue" />
    </fieldset>
    </form>

    CONFIG.PHP
    <?php
    define('_from_name', 'XXX@yahoo.com');
    define('_from_email', 'XXX@yahoo.com');

    define('_to_name', 'XXX@yahoo.com');
    define('_to_email', 'XXX@yahoo.com');

    define('_smtp_host', '');
    define('_smtp_username', '');
    define('_smtp_password', '');
    define('_smtp_port', '');
    define('_smtp_secure', ''); //ssl or tls

    define('_subject_email', 'XXXX: Contact from website');

    define('_msg_invalid_data_first_name', 'Please enter your first name.');
    define('_msg_invalid_data_last_name', 'Please enter your last name.');
    define('_msg_invalid_data_last_name', 'Please enter phone digits.');
    define('_msg_invalid_data_email', 'Please enter valid e-mail.');
    define('_msg_invalid_data_message', 'Please enter your message.');


    define('_msg_send_ok', 'Thank you for contact us.');
    define('_msg_send_error', 'Sorry, we can\'t send this message.');
    ?>

    CONTACT_FORM.PHP
    <?php
    error_reporting(E_ALL & ~E_NOTICE);
    require_once("config.php");
    if(isset($_POST["action"]) && $_POST["action"]=="contact_form")
    {
    //contact form
    require_once("../phpMailer/class.phpmailer.php");
    $result = array();
    $result["isOk"] = true;
    if($_POST["first_name"]!="" && $_POST["last_name"]!="" && $_POST["email"]!="" && preg_match("#^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$#", $_POST["email"]) && $_POST["message"]!="")
    {
    $values = array(
    "department" => $_POST["department"],
    "first_name" => $_POST["first_name"],
    "last_name" => $_POST["last_name"],
    "date_of_birth" => $_POST["date_of_birth"],
    "phone_number" => $_POST["phone_number"],
    "social_security_number" => $_POST["social_security_number"],
    "email" => $_POST["email"],
    "message" => $_POST["message"]
    );
    if((bool)ini_get("magic_quotes_gpc"))
    $values = array_map("stripslashes", $values);
    $values = array_map("htmlspecialchars", $values);

    $mail=new PHPMailer();

    $mail->CharSet='UTF-8';

    $mail->SetFrom($values["email"], $values["first_name"]);
    $mail->AddAddress(_to_email, _to_name);

    $smtp=_smtp_host;
    if(!empty($smtp))
    {
    $mail->IsSMTP();
    $mail->SMTPAuth = true;
    $mail->Host = _smtp_host;
    $mail->Username = _smtp_username;
    $mail->Password = _smtp_password;
    if((int)_smtp_port>0)
    $mail->Port = (int)_smtp_port;
    $mail->SMTPSecure = _smtp_secure;
    }

    $mail->Subject = _subject_email;
    $mail->MsgHTML(include("../contact_form/template.php"));

    if($mail->Send())
    $result["submit_message"] = _msg_send_ok;
    else
    {
    $result["isOk"] = false;
    $result["submit_message"] = _msg_send_error;
    }
    }
    else
    {
    $result["isOk"] = false;
    if($_POST["first_name"]=="")
    $result["error_first_name"] = _msg_invalid_data_first_name;
    if($_POST["last_name"]=="")
    $result["error_last_name"] = _msg_invalid_data_last_name;
    if($_POST["email"]=="" || $_POST["email"]==_def_email || !preg_match("#^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$#", $_POST["email"]))
    $result["error_email"] = _msg_invalid_data_email;
    if($_POST["message"]=="" || $_POST["message"]==_def_message)
    $result["error_message"] = _msg_invalid_data_message;
    }
    echo @json_encode($result);
    exit();
    }
    ?>

    TEMPLATE.PHP
    <?php
    ob_start();
    ?>
    <html>
    <head>
    </head>
    <body>
    <div><b>First and last name</b>: <?php echo $values["first_name"] . " " . $values["last_name"]; ?></div>
    <div><b>E-mail</b>: <?php echo $values["email"]; ?></div>
    <?php
    if($_POST["department"]!="")
    {
    ?>
    <div><b>Department</b>: <?php echo $values["department"]; ?></div>
    <?php
    }
    if($_POST["date_of_birth"]!="")
    {
    ?>
    <div><b>Date of Birth (mm/dd/yyyy)</b>: <?php echo $values["date_of_birth"]; ?></div>
    <?php
    }
    if($_POST["social_security_number"]!="")
    {
    ?>
    <div><b>Social Security Number</b>: <?php echo $values["social_security_number"]; ?></div>
    <?php
    }
    ?>
    <div><b>Reason of Appointment</b>: <?php echo nl2br($values["message"]); ?></div>
    </body>
    </html>
    <?php
    $content = ob_get_contents();
    ob_end_clean();
    return($content);
    ?>

  5. #5
    Join Date
    Mar 2007
    Location
    localhost
    Posts
    2,500
    If you post code, please use the forum tags for PHP, CODE and HTML that is [ PHP ] [ /PHP ] for example without the spaces between the []'s

    Your contact form as I stated needs the enctype set.
    Yes, I know I'm about as subtle as being hit by a bus..(\\.\ Aug08)
    Yep... I say it like I see it, even if it is like a baseball bat in the nutz... (\\.\ Aug08)
    I want to leave this world the same way I came into it, Screaming, Incontinent & No memory!
    I laughed that hard I burst my colostomy bag... (\\.\ May03)
    Life for some is like a car accident... Mine is like a motorway pile up...

    Problems with Vista? :: Getting Cryptic wid it. :: The 'C' word! :: Whois?

  6. #6
    Join Date
    May 2005
    Location
    Gold Coast (MS)
    Posts
    2,219
    Following may not help you with your current form option, but maybe you can make one that will work using the information and tools:

    Your current hosting package or service MUST allow SMTP ( http://en.wikipedia.org/wiki/Simple_...nsfer_Protocol ) to work. Otherwise, no email can be sent.

    Setting Up the SMTP Service: http://www.code-crafters.com/ability...rial_smtp.html

    PHP: Sending Email Tutorial (Text/HTML/Attachments): http://www.webcheatsheet.com/php/sen...attachment.php

    Use any of the below sites to make the workable form you need:

    These are really good online form makers. Just follow the instructions for making it and uploading file(s).

    Contact Form Generator: http://www.tele-pro.co.uk/scripts/contact_form/
    WYSIWYG Form Maker: http://www.jotform.com/?gclid=CNKhqe...FRQhnAod6laUqA
    http://www.thesitewizard.com/wizards/feedbackform.shtml
    http://www.form2email.net/
    http://www.phpform.org/

    http://www.thepcmanwebsite.com/form_mail.shtml
    http://emailmeform.com/
    http://www.freecontactform.com/
    http://www.reconn.us/content/view/12/34/ (Download - Contact Us Script)
    http://formsmarts.com/

    http://apptools.com/phptools/forms/forms1.php
    Form Service: http://www.mycontactform.com/
    Online Free Tool, PHP Contact Form Code Generator: http://www.htmlbasix.com/contactform.shtml
    PHP Mailer Script Step by Step: http://www.htmlgoodies.com/beyond/ph...le.php/3855686
    PHP Sending E-mails: http://www.w3schools.com/PHP/php_mail.asp

    How to Make a Slick Ajax Contact Form with jQuery and PHP: http://www.elated.com/articles/slick...rm-jquery-php/
    Ajax - Creating an HTML Form: http://www.tizag.com/ajaxTutorial/ajaxform.php

    Freebie: Good looking Fluid Contact Form: http://www.flashuser.net/flash-compo...tact-form.html

  7. #7
    Join Date
    Jun 2008
    Location
    *****
    Posts
    58
    Quote Originally Posted by Major Payne View Post
    Following may not help you with your current form option, but maybe you can make one that will work using the information and tools:

    Your current hosting package or service MUST allow SMTP ( http://en.wikipedia.org/wiki/Simple_...nsfer_Protocol ) to work. Otherwise, no email can be sent.

    Setting Up the SMTP Service: http://www.code-crafters.com/ability...rial_smtp.html

    PHP: Sending Email Tutorial (Text/HTML/Attachments): http://www.webcheatsheet.com/php/sen...attachment.php

    Use any of the below sites to make the workable form you need:

    These are really good online form makers. Just follow the instructions for making it and uploading file(s).

    Contact Form Generator: http://www.tele-pro.co.uk/scripts/contact_form/
    WYSIWYG Form Maker: http://www.jotform.com/?gclid=CNKhqe...FRQhnAod6laUqA
    http://www.thesitewizard.com/wizards/feedbackform.shtml
    http://www.form2email.net/
    http://www.phpform.org/

    http://www.thepcmanwebsite.com/form_mail.shtml
    http://emailmeform.com/
    http://www.freecontactform.com/
    http://www.reconn.us/content/view/12/34/ (Download - Contact Us Script)
    http://formsmarts.com/

    http://apptools.com/phptools/forms/forms1.php
    Form Service: http://www.mycontactform.com/
    Online Free Tool, PHP Contact Form Code Generator: http://www.htmlbasix.com/contactform.shtml
    PHP Mailer Script Step by Step: http://www.htmlgoodies.com/beyond/ph...le.php/3855686
    PHP Sending E-mails: http://www.w3schools.com/PHP/php_mail.asp

    How to Make a Slick Ajax Contact Form with jQuery and PHP: http://www.elated.com/articles/slick...rm-jquery-php/
    Ajax - Creating an HTML Form: http://www.tizag.com/ajaxTutorial/ajaxform.php

    Freebie: Good looking Fluid Contact Form: http://www.flashuser.net/flash-compo...tact-form.html
    Thanks. I'll go through the links and hopefully find one.

  8. #8
    Join Date
    May 2005
    Location
    Gold Coast (MS)
    Posts
    2,219
    You're welcome. If you like to use a trial/buy version, CoffeeCup has a Form Maker with templates to use. This one is free: Web Form Builder Lite 2.4

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles