Jump to content

[SOLVED] I need help with my PHP script please!


lnrcount

Recommended Posts

Hi,

Im new to all this but I'm learning fast. I'm tring to create a link exchange form for my new web site.The problem that I have is that I keep getting my error page even when all ths fields are filled out correctly.

 

This is my form code.

<form action="linkexchange.php" method="post">
<table border="0" cellpadding="8" cellspacing="8" summary="Link Exchange Form">
<tr><td>Your Name:</td><td><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>Site Name:</td><td><input type="text" name="sitename" size="25" /></td></tr>
<tr><td>Site URL:</td><td><input type="text" name="siteurl" size="25" /></td></tr>
<tr><td>Reciprocal URL:</td><td><input type="text" name="recipurl" size="25" /></td></tr>
<tr>
<td colspan="2">
Description<br />
<textarea rows="15" cols="45" name="description"></textarea>
</td>
</tr>
<tr>
<td align="center" colspan="2">
<input type="submit" value="Send Request" /><br />
<a href="http://www.thesitewizard.com/">Powered by thesitewizard.com</a>
</td>
</tr>
</table>
</form>

 

And this is the scrit that I have for it.

 

<?

// ------------- CONFIGURABLE SECTION ------------------------

// $mailto - set to the email address you want the form
// sent to, eg
//$mailto		= "[email protected]" ;

$mailto = '[email protected]' ;

// $subject - set to the Subject line of the email, eg
//$subject	= "Feedback Form" ;

$subject = "Link Exchange 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.lnrcountrystore.com/linkexchange.html" ;
$errorurl = "http://www.lnrcountrystore.com/errorpage.html" ;
$thankyouurl = "http://www.lnrcountrystore.com/linkexchangethankyou.html" ;

$uself = 0;

// -------------------- END OF CONFIGURABLE SECTION ---------------

$headersep = (!isset( $uself ) || ($uself == 0)) ? "\r\n" : "\n" ;
$name = $_POST['name'] ;
$email = $_POST['email'] ;
$sitename = $_POST['sitename'] ;
$siteurl = $_POST['siteurl'] ;
$recirocalurl = $_POST['recipurl'] ;
$description = $_POST['description'] ;


$http_referrer = getenv( "HTTP_REFERER" );

if (!isset($_POST['email'])) {
header( "Location: $formurl" );
exit ;
}
if (empty($name) || empty($email) || empty($sitename) || empty($siteurl) || empty($reciprocalurl) || 

empty($description)) {
   header( "Location: $errorurl" );
   exit ;
}
if ( ereg( "[\r\n]", $name ) || ereg( "[\r\n]", $email ) || ereg( "[\r\n]", $sitename )|| ereg( "[\r\n]", $siteurl ) 

|| ereg( "[\r\n]", $reciprocalurl ) ) {
header( "Location: $errorurl" );
exit ;
}

if (get_magic_quotes_gpc()) {
$description = stripslashes( $description );
}

$messageproper =

"This message was sent from:\n" .
"$http_referrer\n" .
"------------------------------------------------------------\n" .
"Name of sender: $name\n" .
"Email of sender: $email\n" .
        "Site Name of sender: $sitename\n" .
        "Site URL of sender: $siteurl\n" .
        "Reciprocal URL of sender: $recipurl\n" .
"------------------------- Description -------------------------\n\n" .
$description .
"\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 ;

?>

 

 

Please help someone!

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.