Im currently creating a site for a friend, which has a list of house addresses linking to the same form.
The form has the following fields:
Address
Contact Name
Phone
Email
Prefered viewing date
Prefered vieiwing time
Message
Is there a way, for instance, that if I clicked on a address call “1 High Street”, it would send me to the form page with the address automatically filled in (1 High Street)?
My php code
contact.php:
<?
//Feel free to change and of these fields. Make sure that you update thankyou.php with any modifications that you make.
?>
<HTML>
<HEAD>
<TITLE>Contact Page</TITLE>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
.style1 {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px;
}
-->
</style>
</HEAD>
<table border="0" cellpadding="0" cellspacing="3">
<form method="post" action="thankyou.php">
<tr><td valign="top" class="style1">*Address:</td>
<td><textarea name="address" rows=10 cols=30></textarea></td>
</tr>
<tr>
<td><span class="style1">*Contact Name:</span></td>
<td><input name="name" type="text"></td>
</tr>
<tr>
<td class="style1">*Phone:</td>
<td><input name="phone" type="text"></td>
</tr>
<tr>
<td class="style1">E-mail:</td>
<td><input name="email" type="text"></td>
</tr>
<tr>
<td class="style1">*Preferred Viewing Date:</td>
<td><input name="date" type="text"></td>
</tr>
<tr>
<td class="style1">*Preferred Viewing Time:</td>
<td><input name="time" type="text"></td>
</tr>
<tr>
<td valign="top" class="style1">Message:</td>
<td><textarea name="message" rows=10 cols=30></textarea></td>
</tr>
<tr><td> </td><td><input type="submit" value="Send Message"></td>
</tr></form>
</table>
<p class="style1">* Fields must be filled in </p>
thankyou.php:
<?
//This command imports the values from contact.php. Please do not touch.
@import_request_variables("gpc");
//The email address the message will be sent to
$youremail = "[email protected]";
//The subject of the email you will receive;
$subject = "Enquiry from website";
//The page your visitor will be redirected to.
$redirect = "http://www.zilch.co.uk/whatever.htm";
//Time until the page redirects your visitor (seconds)
$secs = "5";
?>
<HTML>
<HEAD>
<TITLE>Thank you</TITLE>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
.style1 {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px;
}
-->
</style>
</HEAD>
<table cellpadding=0 cellspacing=0>
<tr>
<td>
<?
//Checks to see if the name, message or email fields are empty. You can delete or add fields as needed.
if ( (!empty($name)) && (!empty($phone)) && (!empty($address)) && (!empty($date)) && (!empty($time))
{
$name = stripslashes($name);
$message = stripslashes($message);
$headers = 'From: '.$email.'';
//This is where the email is sent using your values from above. Be sure to update this if you change any fields in contact.php
mail("$youremail", "$subject","
Name: $name
Email: $email
Address: $address
Phone: $phone
Prefered Viewing Date: $date
Prefered Viewing Time: $time
Message: $message
",$headers);
?>
<meta http-equiv="refresh" content="<?=$secs;?>;URL=<?=$redirect;?>">
<div align="center" class="style1">Thank you, we have received your message.
</div><p align="center"><span class="style1">
You are now being redirected to our <a href="<?=$redirect;?>">homepage</a>.
<?
}
else
{
?>
We require your name email address and a message in order to reply to your message. Please click <a href="javascript:history.back(1);">here</a> or your browsers back button to try again.</span>
<?
}
?>
</td>
</tr>
</table>
Can anyone please help…