Jump to content

Email Form On Php5


Recommended Posts

I have had this code working on PHP4 platforms, but on my new PHP5 it does not.All the checks work and everything...the confirmation of an email sent show too.But the email never shows up.

	 <?PHP			if($_POST['submit'])		{					//From visitor			$yy567yy	= $_POST['yy567yy'];//Posters name			$tt55tree55 = $_POST['tt55tree55'];//Posters email			$ii980ii	= $_POST['ii980ii'];//Posters comments						//This is the function to validate the email			include 'contact_validate_email.php'; 			if(!validateEmail(trim($_POST['tt55tree55'])))				$error1 = "The email address entered is not valid.<br /><br />";						// Check for empty fields			if ($_POST['ii980ii'] == "" OR $_POST['yy567yy'] == "" OR $_POST['tt55tree55'] == "")				$error2 =  "You forgot a mandatory field.<br />(All fields must have text)<br /><br />";			if($error1 == '' && $error2 == '')			{										// DB info grab of who is getting email				$result   = mysql_query("SELECT * FROM `users` WHERE `id` = '1' LIMIT 1")or die(mysql_error()); 				$r		= mysql_fetch_array($result);				$db_email = $r['email'];								//set up info				$nowDay   = date("m.d.Y");				$nowClock = date("H:i:s");								$to		= $db_email;				$u_message = $ii980ii;				$subject   = 'Website email';				$site	  = 'http://www.site.ca';								@$message =								// we now generate a nice form for emailing								"Message sent: $nowDay at $nowClock:\n\n".				"---------------------- Senders Info ----------------------\n\n".				"From: $yy567yy\n".				"Location: site.ca\n".				"Email: $tt55tree55\n".								"----------------------- COMMENTS ----------------------\n\n".								stripslashes($u_message).				"\n\n\n".				"----------------------------------------------------------------\n\n";				// The URLs matched so send the email				$mail = mail($to, stripslashes($subject), $message, "From: $yy567yy <$tt55tree55>")or die(mysql_error()); 				if($mail)				{					echo 'Thank you for your inquiry.<br />Your email has been sent to Dave.';					//echo '<br>' . $db_tt55tree55;					session_destroy();					unset($_SESSION['s_yy567yy']);					unset($_SESSION['s_tt55tree55']);					unset($_SESSION['s_ii980ii']);				}					else				{					echo 'The was a problem. <br><a href="bio.php" class="light-14-link">Try again</a>';				}			}		if(!$error1 == '' || !$error2 == '')		{			echo $error1;			echo $error2;			echo '<a href="bio.php" class="light-14-link">Try again</a>';		}		//There was no post so show the form								}			else		{?>	  Contact Dave:	  <form action="bio.php" method="POST">			<!--<input type="text" name="email" style="display: none;" value="bots are bad">-->			Your name:	   			<br />		<input name="yy567yy" type="text" class="txtbox" value="<?PHP echo stripslashes($_SESSION['s_yy567yy']);?>" size="28"/>			<br />			Your email:			<br />		<input name="tt55tree55" type="text" class="txtbox" value="<?PHP echo $_SESSION['s_tt55tree55'];?>" size="28"/>			<br />			Comments:			<br />		<textarea name="ii980ii" cols="25" rows="6" class="txtbox" value=""><?PHP echo stripslashes($_SESSION['s_ii980ii']);?></textarea>			<br />			<input name="submit" type="submit" class="txtbox" value="Send Email" />	  </form>	  <?PHP		}?>

Stumped again...Thank you for your time

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...