What I'm trying to do is on submission of a referral form, have PHP create a random alphanumeric string of about 8 characters and submit it via email to myself, the referrer and post the string to the thanks.php page visitors are redirected to on submission of the form.
The current referral form is functional currently as:
<div class="content">
<?php
$action=$_REQUEST['action'];
if ($action=="")
{
?>
<form action="" method="POST" enctype="multipart/form-data">
<input type="hidden" name="action" value="submit">
<input name="name" type="text" placeholder="Your Name" value="" size="14"/>
<input name="email" type="text" placeholder="Your Email" value="" size="14"/>
<input name="who" type="text" placeholder="Who should we contact?" size="14">
<input name="how" type="text" placeholder="How can we reach them?" size="14">
<textarea name="message" placeholder="Anything else we should know?" rows="2" cols="14"></textarea><br>
<input type="submit" class="button special" value="SUBMIT"/>
</form>
<?php
}
else
{
$name=$_REQUEST['name'];
$email=$_REQUEST['email'];
$message= "\n\rWho: " . $_REQUEST['who'] . "\n\rDescription: " . $_REQUEST['message']. "\n\rContact: " . $_REQUEST['how'];
if (($name=="")||($email=="")||($message==""))
{
echo "All fields are required, please fill out <a href=\"\">the form</a> again.";
}
else{
$from="From: $name<$email>\r\nReturn-path: $email";
$subject="Referral for ********";
mail("chris@********.com.au", $subject, $message, $from);
}
{
echo "<script type='text/javascript'>window.location.href ='../thanks.php';</script>";
}
}
?>
What I'd like is for the contact form to contain that newly created string and send it as part of the email as one of the "\n\rString: " . $_REQUEST['String'] . elements. Then, as the 'thank you' page loads, take the same string from the session and have it displayed among a description for referrers as being their reference for that specific referral.
Any suggestions of where I should start?
Aucun commentaire:
Enregistrer un commentaire