www.webdeveloper.com
Results 1 to 4 of 4

Thread: HTML form won't work with 5.4

  1. #1
    Join Date
    Jul 2006
    Posts
    8

    HTML form won't work with 5.4

    Not sure if this should be in PHP or HTML forum...

    In 2005 I had someone make a form on my website that is emailed to me. Problem is that the hosting company is upgrading to PHP 5.4 and this form does not work with 5.4

    Any assistance in correcting this to comply with 5.4 is greatly appreciated. Again, the form works fine with PHP 4.

    This is the HTML:
    <form id="signup" action="mail.php" method="post" onsubmit="return validate_form ( );">


    Here is the mail.php that the html form uses:
    ---- ----- ---- ----- ---- ----- ---- ----- ---- ----- ---- -----

    <?
    if (empty($email))
    exit();

    $to = 'gemaine@dvimest.org';
    $subject = 'Form Request';
    $message = 'State: ' . $_REQUEST['State'] .

    "\n Name " . $_REQUEST['nameself'] .
    "\n " .
    "\n Spouse " . $_REQUEST['namespouse'] .
    "\n " .
    "\n Phone-- " . $_REQUEST['phone'] .
    "\n " .
    "\n Email " . $_REQUEST['email'] .
    "\n\n " .

    $email = $_REQUEST['email'];
    $headers = 'From: ' . $email . "\r\n" .
    'Reply-To: ' . $email . "\r\n" .
    'X-Mailer: PHP/' . phpversion();

    mail ($to, $subject, $message, $headers);
    header("Location: formresponse.html");
    ?>

    ---- ----- ---- ----- ---- ----- ---- ----- ---- ----- ---- -----

  2. #2
    Join Date
    Dec 2012
    Posts
    9
    Mmm this form is badly coded a few things i notice off the bat include

    1)The use of $_REQUEST instead of just using the $_POST array
    2)Using javascript to validate the form, way bad idea you should be using php to validate a php form
    3)Using a user submitted email in this part $headers = 'From: ' . $email . "\r\n" . this can lead to some pretty bad header injections never allow the user to submit any form data inside headers if you do require it besure you are cleaning the data properly in order to prevent header injections

    lastly its good practice to throw in a exit; after your header redirect this means if for some reason the page does not redirect properly the rest of the script is ended.

    like i said these are just a few things if you would like me to rebuild the form for you i can but will charge a tad for my time its up to you. Hope ive helped some.

  3. #3
    Join Date
    Dec 2012
    Posts
    9
    Mmm this form is badly coded a few things i notice off the bat include

    1)The use of $_REQUEST instead of just using the $_POST array
    2)Using javascript to validate the form, way bad idea you should be using php to validate a php form
    3)Using a user submitted email in this part $headers = 'From: ' . $email . "\r\n" . this can lead to some pretty bad header injections never allow the user to submit any form data inside headers if you do require it besure you are cleaning the data properly in order to prevent header injections

    lastly its good practice to throw in a exit; after your header redirect this means if for some reason the page does not redirect properly the rest of the script is ended.

    like i said these are just a few things if you would like me to rebuild the form for you i can but will charge a tad for my time its up to you. Hope ive helped some.

  4. #4
    Join Date
    Dec 2012
    Posts
    9
    Btw excuse the double posting tht was by accident

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