Contact Form Php5 Help..

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Psyloke
Forum Newbie
Posts: 1
Joined: Tue Jan 19, 2010 12:53 pm

Contact Form Php5 Help..

Post by Psyloke »

Hi, I've made several websites with Swish and used the php scripts i've grabbed from the net for the contact forms, but now my main server has updated to php5 and the contact form on that website doesn't work. Can anyone give me some advice? I do not really know php, have just muddled through somehow.

Here's the original script that works on php4 server:


<?
if ($send=="yes") {
$to = "myemail";
$subject = "$subjectVar";
$body .= "$msgVar";
$from = "$nameVar";
$tfrom = "From: <$emailVar>";
mail($to,$subjectVar,$msgVar,$tfrom);
}
echo "&errormessage=Email has been sent&";
?>



and here's my attempt at updating it to php5:
<?
if ($send=="yes") {
$to = "myemail";
$subject = "$_POST['subjectVar']";
$body .= "$_POST['msgVar']";
$from = "$_POST['nameVar']";
$tfrom = "From: <$_POST['emailVar']>";
mail($to,$_POST['subjectVar'],$_POST['msgVar'],$tfrom);
}
echo "&errormessage=Email has been sent&";
?>


any help greatly apprecated!
User avatar
AbraCadaver
DevNet Master
Posts: 2572
Joined: Mon Feb 24, 2003 10:12 am
Location: The Republic of Texas
Contact:

Re: Contact Form Php5 Help..

Post by AbraCadaver »

Most likely you need to change $send to $_POST['send'] and try changing the <? to <?php
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
Post Reply