Jump to content


Photo

Html Form Won't Work With 5.4


  • Please log in to reply
3 replies to this topic

#1 kkrimmer

kkrimmer

    Newbie

  • New Members
  • Pip
  • 2 posts

Posted 03 December 2012 - 01:43 PM

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

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 SocialCloud

SocialCloud

    Advanced Member

  • Members
  • PipPipPip
  • 620 posts

Posted 03 December 2012 - 02:11 PM

Perhaps they changed settings, change your opening <? tag to <?php

#3 Pikachu2000

Pikachu2000

    I hate everything.

  • Staff Alumni
  • 11,378 posts
  • LocationFuture Independent Republic of Texas
  • Age:106

Posted 03 December 2012 - 02:20 PM

It relies on a setting in php that should be turned off, and remain off. You need to explicitly assign the value from the form to $email in your if( empty($email) ) { conditional, or use the form value directly in it.
"Java" is to "Javascript" about the same as "fun" is to "funeral".

Why $_SERVER['PHP_SELF'] is bad. || Why ORDER BY RAND() is bad || Every problem can be solved with rm -rf *

Random Quote: "

#4 kkrimmer

kkrimmer

    Newbie

  • New Members
  • Pip
  • 2 posts

Posted 03 December 2012 - 02:44 PM

Thank you Pikachu2000 ... removing those lines works...




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

Cheap Linux VPS from $5
SSD Storage, 30 day Guarantee
1 TB of BW, 100% Network Uptime

AlphaBit.com