vibeit Posted April 5, 2007 Share Posted April 5, 2007 Hello, This is my first attempt at using PHP scripts, and I have only been looking at PHP for about a week... I have 1 form working fine. But I tried to create additional forms by editing the same script that currently runs fine, and it just sends me to the error page when I submit the request???. feedback.phph and HTML works fine but the Profile.php/HTML and the Newsletter.php/HTML I am about freak out over . I am sure it will be an obvious mistake to anyone that knows what there doing, but for now Im fresh out of answers... Can anyone help me please? Feedback.php and the HTML form... The working PHP code: <? // ------------- CONFIGURABLE SECTION ------------------------ // $mailto - set to the email address you want the form // sent to, eg //$mailto = "youremailaddress@example.com" ; $mailto = 'info@bodyads.com.au' ; // $subject - set to the Subject line of the email, eg //$subject = "Feedback Form" ; $subject = "Feedback Form" ; // the pages to be displayed, eg //$formurl = "http://www.example.com/feedback.html" ; //$errorurl = "http://www.example.com/error.html" ; //$thankyouurl = "http://www.example.com/thankyou.html" ; $formurl = "http://www.bodyads.com.au/contact.html" ; $errorurl = "http://www.bodyads.com.au/error.html" ; $thankyouurl = "http://www.bodyads.com.au/thanks.html" ; $uself = 0; // -------------------- END OF CONFIGURABLE SECTION --------------- $headersep = (!isset( $uself ) || ($uself == 0)) ? "\r\n" : "\n" ; $name = $_POST['name'] ; $email = $_POST['email'] ; $phone = $_POST['phone'] ; $comments = $_POST['comments'] ; $http_referrer = getenv( "HTTP_REFERER" ); if (!isset($_POST['email'])) { header( "Location: $formurl" ); exit ; } if (empty($name) || empty($email) || empty($comments)) { header( "Location: $errorurl" ); exit ; } if ( ereg( "[\r\n]", $name ) || ereg( "[\r\n]", $email ) ) { header( "Location: $errorurl" ); exit ; } if (get_magic_quotes_gpc()) { $comments = stripslashes( $comments ); } $messageproper = "This message was sent from:\n" . "$http_referrer\n" . "------------------------------------------------------------\n" . "Name of sender: $name\n" . "Email of sender: $email\n" . "Phone number of sender: $phone\n" . "------------------------- COMMENTS -------------------------\n\n" . $comments . "\n\n------------------------------------------------------------\n" ; mail($mailto, $subject, $messageproper, "From: \"$name\" <$email>" . $headersep . "Reply-To: \"$name\" <$email>" . $headersep . "X-Mailer: chfeedback.php 2.07" ); header( "Location: $thankyouurl" ); exit ; ?> The working HTML code: <form action="feedback.php" method="post"> <table border="0" cellpadding="8" cellspacing="8" summary="feedback form"> <tr> <td width="76"><span class="style3">*</span>Name:</td> <td width="430"><input type="text" name="name" size="25" /></td></tr> <tr> <td><span class="style3">*</span>Email address:</td> <td><input type="text" name="email" size="25" /></td></tr> <tr> <td><span class="style3">*</span>Phone number:</td> <td><input name="phone" type="text" id="phone" size="25" /></td> </tr> <tr> <td colspan="2"> <span class="style3">*</span>Comments<br /> <textarea rows="15" cols="55" name="comments"></textarea></td> </tr> <tr> <td align="center" colspan="2"> <input type="submit" value="Send Feedback" /><br /> <a href="http://www.vibeit.com/">Powered by VIBE IT</a></td> </tr> </table> </form> profile.php and the HTML form The not working PHP code: <? // ------------- CONFIGURABLE SECTION ------------------------ // $mailto - set to the email address you want the form // sent to, eg //$mailto = "youremailaddress@example.com" ; $mailto = 'info@bodyads.com.au' ; // $subject - set to the Subject line of the email, eg //$subject = "Feedback Form" ; $subject = "Profile" ; // the pages to be displayed, eg //$formurl = "http://www.example.com/feedback.html" ; //$errorurl = "http://www.example.com/error.html" ; //$thankyouurl = "http://www.example.com/thankyou.html" ; $formurl = "http://www.bodyads.com.au/contact.html" ; $errorurl = "http://www.bodyads.com.au/error.html" ; $thankyouurl = "http://www.bodyads.com.au/thanks.html" ; $uself = 0; // -------------------- END OF CONFIGURABLE SECTION --------------- $headersep = (!isset( $uself ) || ($uself == 0)) ? "\r\n" : "\n" ; $name = $_POST['name'] ; $email = $_POST['email'] ; $phone = $_POST['phone'] ; $address = $_POST['adrress'] ; $city = $_POST['city'] ; $counrty = $_POST['country'] ; $code = $_POST['code'] ; $age = $_POST['age'] ; $status = $_POST['status'] ; $occupation = $_POST['occupation'] ; $income = $_POST['income'] ; $available = $_POST['available'] ; $promo = $_POST['promo'] ; $personality = $_POST['personality'] ; $locations = $_POST['Locations'] ; $http_referrer = getenv( "HTTP_REFERER" ); if (!isset($_POST['email'])) { header( "Location: $formurl" ); exit ; } if (empty($name) || empty($email) || empty($comments)) { header( "Location: $errorurl" ); exit ; } if ( ereg( "[\r\n]", $name ) || ereg( "[\r\n]", $email ) ) { header( "Location: $errorurl" ); exit ; } if (get_magic_quotes_gpc()) { $comments = stripslashes( $comments ); } $messageproper = "This message was sent from:\n" . "$http_referrer\n" . "------------------------------------------------------------\n" . "Name of sender: $name\n" . "Email of sender: $email\n" . "Phone number of sender: $phone\n" . "Address of sender: $address\n" . "City of sender: $city\n" . "Country of sender: $country\n" . "Code of sender: $code\n" . "Age of sender: $age\n" . "Status of sender: $status\n" . "Occupation of sender: $occupation\n" . "Income of sender: $income\n" . "Available of sender: $available\n" . "Promo of sender: $promo\n" . "Personality of sender: $personality\n" . "Locations of sender: $locations\n" . "------------------------- COMMENTS -------------------------\n\n" . $promo . $personality . $profile . "\n\n------------------------------------------------------------\n" ; mail($mailto, $subject, $messageproper, "From: \"$name\" <$email>" . $headersep . "Reply-To: \"$name\" <$email>" . $headersep . "X-Mailer: chfeedback.php 2.07" ); header( "Location: $thankyouurl" ); exit ; ?> The not working HTML code: <form action="profile.php" method="post"> <table border="0" cellpadding="8" cellspacing="8" summary="Member Profile"> <tr> <td width="76"><span class="style3">*</span>Name:</td> <td width="430"><input type="text" name="name" size="25" /></td></tr> <tr> <td><span class="style3">*</span>Email address:</td> <td><input type="text" name="email" size="25" /></td></tr> <tr> <td><span class="style3">*</span>Phone number:</td> <td><input name="phone" type="text" id="phone" size="25" /></td> </tr> <tr> <td><span class="style3">*</span>Address:</td> <td><input name="address" type="text" id="address" size="25" /></td> </tr> <tr> <td><span class="style3">*</span>City:</td> <td><input name="city" type="text" id="city" size="25" /></td> </tr> <tr> <td><span class="style3">*</span>Country:</td> <td><input name="country" type="text" id="country" size="25" /></td> </tr> <tr> <td><span class="style3">*</span>State / Teritory:</td> <td><input name="state" type="text" id="state" size="25" /></td> </tr> <tr> <td><span class="style3">*</span>Post Code:</td> <td><input name="code" type="text" id="code" size="25" /></td> </tr> <tr> <td><span class="style3">*</span>AGE:</td> <td><input name="age" type="text" id="age" size="25" /></td> </tr> <tr> <td><span class="style3">*</span>Marital Status:</td> <td><input name="status" type="text" id="status" size="25" /></td> </tr> <tr> <td><span class="style3">*</span>Occupation:</td> <td><input name="occupation" type="text" id="occupation" size="25" /></td> </tr> <tr> <td><span class="style3">*</span>Current Income:</td> <td><input name="income" type="text" id="income" size="25" /></td> </tr> <tr> <td><span class="style3">*</span>Availability:</td> <td><input name="available" type="text" id="available" size="25" /></td> </tr> <td height="126" colspan="2"><p><span class="style3">*</span>What body part/s are you willing to have advertisments promoted on? and what would you do to promote an advertisers product? <br /> <textarea rows="5" cols="60" name="promo"></textarea> </p> </td> </tr> <td height="126" colspan="2"><p><span class="style3">*</span>Please describe your personality. What would other people say about you? <br /> <textarea rows="5" cols="60" name="personality"></textarea> </p> </td> </tr> <td height="126" colspan="2"><p><span class="style3">*</span>What types of places do you hang out at? This is <span class="style6">IMPORTANT!!! </span><br /> <textarea rows="5" cols="60" name="locations"></textarea> </p> </td> </tr> <tr> <td align="center" colspan="2"> <input type="submit" value="Send Feedback" /><br /> <a href="http://www.vibeit.com/">Powered by VIBE IT</a></td> </tr> </table> </form> newsletter.php and the HTML form The not working PHP code: <? // ------------- CONFIGURABLE SECTION ------------------------ // $mailto - set to the email address you want the form // sent to, eg //$mailto = "youremailaddress@example.com" ; $mailto = 'news@bodyads.com.au' ; // $subject - set to the Subject line of the email, eg //$subject = "Feedback Form" ; $subject = "Newsletter" ; // the pages to be displayed, eg //$formurl = "http://www.example.com/feedback.html" ; //$errorurl = "http://www.example.com/error.html" ; //$thankyouurl = "http://www.example.com/thankyou.html" ; $formurl = "http://www.bodyads.com.au/contact.html" ; $errorurl = "http://www.bodyads.com.au/error.html" ; $thankyouurl = "http://www.bodyads.com.au/thanks.html" ; $uself = 0; // -------------------- END OF CONFIGURABLE SECTION --------------- $headersep = (!isset( $uself ) || ($uself == 0)) ? "\r\n" : "\n" ; $name = $_POST['name'] ; $email = $_POST['email'] ; $http_referrer = getenv( "HTTP_REFERER" ); if (!isset($_POST['email'])) { header( "Location: $formurl" ); exit ; } if (empty($name) || empty($email) || empty($comments)) { header( "Location: $errorurl" ); exit ; } if ( ereg( "[\r\n]", $name ) || ereg( "[\r\n]", $email ) ) { header( "Location: $errorurl" ); exit ; } if (get_magic_quotes_gpc()) { $comments = stripslashes( $comments ); } $messageproper = "This message was sent from:\n" . "$http_referrer\n" . "------------------------------------------------------------\n" . "Name of sender: $name\n" . "Email of sender: $email\n" . "\n\n------------------------------------------------------------\n" ; mail($mailto, $subject, $messageproper, "From: \"$name\" <$email>" . $headersep . "Reply-To: \"$name\" <$email>" . $headersep . "X-Mailer: chfeedback.php 2.07" ); header( "Location: $thankyouurl" ); exit ; ?> [b]The not working HTML code:[/b] <<form action="newsletter.php" method="post"> <table width="245" border="0" align="center" cellpadding="8" cellspacing="8" summary="feedback form"> <tr> <td width="55">Name:</td> <td width="134"><input type="text" name="name" size="25" /></td> </tr> <tr> <td>Email address:</td> <td><input type="text" name="email" size="25" /></td> </tr> <tr> <td align="center" colspan="2"><div align="right"> <input name="submit" type="submit" value="Send Feedback" /> </div></td> </tr> </table> </form> To anyone that can help me with my problem, I am very gratefull and appreciative of your time and effort. Thank You, Troy Quote Link to comment https://forums.phpfreaks.com/topic/45649-first-php-script-installation-please-help/ Share on other sites More sharing options...
AndyB Posted April 5, 2007 Share Posted April 5, 2007 in a non-working example: if (empty($name) || empty($email) || empty($comments)) { ... the value of $comments is never determined by your script. PLEASE wrap your code samples with CODE tags when posting here. Quote Link to comment https://forums.phpfreaks.com/topic/45649-first-php-script-installation-please-help/#findComment-221698 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.