graham23s Posted June 19, 2007 Share Posted June 19, 2007 Hi Guys, iv coded a simple php contact form, iv used a function to clean up the inputs , clean up all the characters and backslashes but when i do a test say : it's it comes out like it/s iv used this function before on another site it worked great can anyone see any problems: <?php // the includes...////////////////////////////////////////////////////////////////// include("includes/db_connection.php"); include("includes/constants.php"); include("includes/header.php"); include("includes/navbar.php"); include("includes/functions.php"); ?> <?php echo '<center>'; ## begin isset ##################################################################### if(isset($_POST['submit'])) { ## grab the posts ################################################################## $name = $_POST['name']; $email = $_POST['email']; $from = "[email protected]"; $subject = CleanPosts($_POST['subject'],1); $message = CleanPosts($_POST['message'],1); $body = "Hi, <b>Raz/Graham</b><br /><br />"; $body .="Someone Has Contacted Us Via The Contact Page The Message Is Below:<br /><br />"; $body .="Email: <b>$email</b><br />Name: <b>$name</b><br /><br />"; $body .="---------------------------------- MESSAGE ----------------------------------<br />"; $body .="$message<br />"; $body .="---------------------------------- MESSAGE ----------------------------------<br /><br />"; $headers = "MIME-Version: 1.0\r\n"; $headers = "From: xxxxxxxxxxxx<$from>\n"; $headers .= "Content-type: text/html; charset=iso-8859-1\r\n"; // empty fields...////////////////////////////////////////////////////////////////// if(empty($name) || empty($email) || empty($subject) || empty($message)) { echo '<br /><font color="red">Error:</font> Sorry, But 1 Or More Fields Were Left Blank! Click (<a href="javascript: history.go(-1)">Here</a>) To Go Back And Fix It.<br /><br />'; include("includes/footer.php"); exit; } $mail_ok = mail("[email protected]","$subject","$body","$headers"); if($mail_ok) { echo '<br /><span class="success">Thank You, Message Has Been Sent Successfully.</span><br /><br />'; } else { echo '<br /><font color="error">Error:</font> Sorry There Was An Error Sending Your Message.<br /><br />'; } } else { echo '<br /><br /> <table width="600" border="1" bordercolor="#8f0002" cellpadding="3" cellspacing="0" /> <form action="'.$_SERVER['PHP_SELF'].'" METHOD="POST" /> <tr> <td colspan="2" bgcolor="#8f0002"><img src="images/contact.gif" /></td> </tr> <tr> <td align="right" width="200">Please Enter Your Name:</td><td align="left" width="300"><input type="text" name="name" /><font color="red" />*</font></td> </tr> <tr> <td align="right" width="200">Please Enter Your E-Mail:</td><td align="left"><input type="text" name="email" /><font color="red" />*</font></td> </tr> <tr> <td align="right" width="200">Please Enter A Subject:</td><td align="left"><input type="text" name="subject" /><font color="red" />*</font></td> </tr> <tr> <td align="right" width="200" valign="top">Please Enter A Message:</td><td align="left"><textarea name="message" cols="30" rows="10" /></textarea><font color="red" />*</font></td> </tr> <td bgcolor="#8f0002" width="600" height="30" colspan="2" align="right"/><input class="button" type="submit" name="submit" value="Contact >>>" /></td> </table></form><font size="2" /><font color="red" />*</font> Field Required</font><br /><br />'; } ## end isset ####################################################################### ?> the function <?php #################################################################################### # clean up the sql inputs $pm_message = CleanStrings($_POST['pm_message'], 1); #################################################################################### function CleanPosts($String, $nlbr = false) { if (get_magic_quotes_gpc()) { $String = stripslashes($String); } if ($nlbr) { $String = nl2br($String); } return mysql_real_escape_string($String); } ?> thanks guys Graham Link to comment https://forums.phpfreaks.com/topic/56172-functions-not-including/ Share on other sites More sharing options...
MasterACE14 Posted June 19, 2007 Share Posted June 19, 2007 Have you recieved any errors at all? Regards ACE Link to comment https://forums.phpfreaks.com/topic/56172-functions-not-including/#findComment-277507 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.