...

View Full Version : PHP contact form stoped working please help!!



batas
01-07-2010, 06:54 PM
my PHP contact form stopped working on my site.(hosted on Yahoo server) I still able to receive it, but without any data input, or contents.Just like that:
Hi,
Following are the details of new request from "Report technical issue" form.
Name:
Company:
Address:
Email Address:
Phone Number:
Type of Issue:
Comments:
Thank You,

Here is the code:
Hi,<br>
<p>Following are the details of new request from \"Report technical issue\" form.</p>
<p><strong>Name</strong>: $yname<br>
<strong>Company</strong>: $company<br>
<strong>Address</strong>: $address<br>
<strong>Email Address</strong>: $emailadd<br>
<strong>Phone Number</strong>: $phone<br>
<strong>Type of Issue</strong>: $type<br>
<strong>Comments</strong>: $questions</p>
<p><strong>Thank You,<br>
<a target=\"_blank\" style=\"text-decoration:none;\" href=\"http://www.mysite.com/\">mysite.Com</a></strong><br>
<a style=\"text-decoration:none;\" href=\"mailto:info@mysite.com\">info@mysite.com</a></p>
</font>
";
$emailto = "info@mysite.com";

$tsubject = "Technical issue Found";
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
@mail($emailto, $tsubject, $ttext, $headers);

header("Location: $thankyoupage");
exit;
?>



Any ideas what could be a problem? I really appreciate it.:(

mlseim
01-07-2010, 06:59 PM
Show us the whole script ...
We can't see the part where your form variables get $_POST-ed in the script.

angst
01-07-2010, 07:03 PM
also please CODE wrap your script!


http://codingforums.com/showthread.php?t=68462

batas
01-08-2010, 03:04 PM
<?
$thankyoupage = "http://www.interlot.com/thanks-for-supplier.html";
$ttext = "
<font size=\"2\" color=\"#333333\" face=\"Verdana, Arial, Helvetica, sans-serif\">
Hi,<br>
<p>Following are the details of new request from \"Report technical issue\" form.</p>
<p><strong>Name</strong>: $yname<br>
<strong>Company</strong>: $company<br>
<strong>Address</strong>: $address<br>
<strong>Email Address</strong>: $emailadd<br>
<strong>Phone Number</strong>: $phone<br>
<strong>Type of Issue</strong>: $type<br>
<strong>Comments</strong>: $questions</p>
<p><strong>Thank You,<br>
<a target=\"_blank\" style=\"text-decoration:none;\" href=\"http://www.interlot.com/\">InterLot.Com</a></strong><br>
<a style=\"text-decoration:none;\" href=\"mailto:sales@interlot.com\">sales@interlot.com</a></p>
</font>
";
$emailto = "sales@interlot.com";

$tsubject = "Technical issue Found";
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
@mail($emailto, $tsubject, $ttext, $headers);

header("Location: $thankyoupage");
exit;
?>

angst
01-08-2010, 03:13 PM
this isn't the whole script, where are these variables coming from ?? I don't see any form requests.

also, please WRAP your script as posted above.

tomws
01-08-2010, 03:41 PM
this isn't the whole script, where are these variables coming from ??

Not necessarily. It could have been coded for PHP4, or perhaps PHP5 assuming register_globals.

angst
01-08-2010, 03:43 PM
Not necessarily. It could have been coded for PHP4, or perhaps PHP5 assuming register_globals.

yes, that might be. from what he is describing it sounds like could be the case, if php was upgraded on the server.

batas
01-08-2010, 04:21 PM
Yes, i just found out that PHP has been upgraded and Register Globals are disallowed . i'm not sure how to fix that? :mad:

tomws
01-08-2010, 05:10 PM
You didn't provide the form's code, so I'll guess it's sending data by POST. There are a couple of ways to use that data.

First, you can just use the $_POST array where you need it. For example, assuming your variables are the field names:

$ttext = "
<font size=\"2\" color=\"#333333\" face=\"Verdana, Arial, Helvetica, sans-serif\">
Hi,<br>
<p>Following are the details of new request from \"Report technical issue\" form.</p>
<p><strong>Name</strong>: ".$_POST['yname']."<br>
...and so on...";
In some form handling cases, that introduces security problems. Therefore, many get in the habit of "catching" the posted data before doing anything with it. So, near the top of the form handler code, they might have lots of these:

$yform = $_POST['yform'];
This might be the easier method for you so that you don't actually need to modify the long message body string. Just add one for each variable.

You should also probably do some reading on PHP5 form handling so that you know when to sanitize the form data.

batas
01-08-2010, 07:39 PM
it worked. Thanks a Million!!!!!!:thumbsup: U're a genius!!!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum