I have a form and would like to have it do the following:
When the form is submited it pops up a window (e.g. 200px x 200px) which is defined by me in the script. all the variables from the form are p***ed to the PHP script in the new window.
these are the variables I wish to send:
$Name
$Email
$Telephone
$Message
<form action="scripts/sitemail.php" method="post" name="contact_form" target="_parent" id="contact_form">
<table width="352" border="0" cellspacing="2" cellpadding="0">
<tr>
<td colspan="2"> <strong>Form:</strong></td>
</tr>
<tr cl***="12">
<td colspan="2"> </td>
</tr>
<tr cl***="12">
<td width="83">Name:</td>
<td width="255"><input name="name" type="text" id="name" size="40">
</td>
</tr>
<tr cl***="12">
<td>Email:</td>
<td><input name="email" type="text" id="email" size="40"></td>
</tr>
<tr cl***="12">
<td>Tel No:</td>
<td><input name="number" type="text" id="number" size="40"></td>
</tr>
<tr cl***="12">
<td>Message:</td>
<td rowspan="6"><textarea name="message" cols="30" rows="6" id="message"></textarea></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td>
<div align="right"> </div></td>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="70%"><div align="left"><span ID="results" >
</span></div></td>
<td width="30%"><div align="right"><a href="java script:;" onClick="return validcontact()" onMouseOver="MM_swapImage('sendbutton','','images/send_in.jpg',1)" onMouseOut="MM_swapImgRestore()"><img src="images/send.jpg" name="sendbutton" width="100" height="33" border="0" id="sendbutton"></a></div></td>
</tr>
</table></td>
</tr>
</table>
</form>
--------------------------------------------------------------------------------
The validation script:
PHP:
--------------------------------------------------------------------------------
function validcontact()
{
if (document.contact_form.name.value == "")
{ document.getElementById('results').innerHTML = "<strong>* Please fill in your name.</strong>"; document.getElementById('results').style.color='#E 6322E'; return false; }
else if (document.contact_form.email.value.search("@") == -1 || document.contact_form.email.value.search("[.*]") == -1)
{ document.getElementById('results').innerHTML = "<strong>* Please enter a valid email.</strong>"; document.getElementById('results').style.color='#E 6322E'; return false; }
else if (document.contact_form.message.value == "")
{ document.getElementById('results').innerHTML = "<strong>* Please fill in your Message.</strong>"; document.getElementById('results').style.color='#E 6322E'; return false; }
else
{ document.getElementById('results').innerHTML = "<strong>Sending message....</strong>"; document.getElementById('results').style.color='#E 6322E';document.contact_form.submit(); return true; }
}
--------------------------------------------------------------------------------
The PHP script:
PHP:
--------------------------------------------------------------------------------
$YourEmail = 'email@domainname.com';
$date = gmdate("D dS M,Y h:i a");
$content="
Webmail Message
From: $name
Email: $email
Tel No: $number
Message:
$message
==============================
This email was generated on $date
";
mail($YourEmail, "Webmail from $name", $content, "From: $email");
print "Thankyou for your email"
When the form is submited it pops up a window (e.g. 200px x 200px) which is defined by me in the script. all the variables from the form are p***ed to the PHP script in the new window.
these are the variables I wish to send:
$Name
$Telephone
$Message
<form action="scripts/sitemail.php" method="post" name="contact_form" target="_parent" id="contact_form">
<table width="352" border="0" cellspacing="2" cellpadding="0">
<tr>
<td colspan="2"> <strong>Form:</strong></td>
</tr>
<tr cl***="12">
<td colspan="2"> </td>
</tr>
<tr cl***="12">
<td width="83">Name:</td>
<td width="255"><input name="name" type="text" id="name" size="40">
</td>
</tr>
<tr cl***="12">
<td>Email:</td>
<td><input name="email" type="text" id="email" size="40"></td>
</tr>
<tr cl***="12">
<td>Tel No:</td>
<td><input name="number" type="text" id="number" size="40"></td>
</tr>
<tr cl***="12">
<td>Message:</td>
<td rowspan="6"><textarea name="message" cols="30" rows="6" id="message"></textarea></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td>
<div align="right"> </div></td>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="70%"><div align="left"><span ID="results" >
</span></div></td>
<td width="30%"><div align="right"><a href="java script:;" onClick="return validcontact()" onMouseOver="MM_swapImage('sendbutton','','images/send_in.jpg',1)" onMouseOut="MM_swapImgRestore()"><img src="images/send.jpg" name="sendbutton" width="100" height="33" border="0" id="sendbutton"></a></div></td>
</tr>
</table></td>
</tr>
</table>
</form>
--------------------------------------------------------------------------------
The validation script:
PHP:
--------------------------------------------------------------------------------
function validcontact()
{
if (document.contact_form.name.value == "")
{ document.getElementById('results').innerHTML = "<strong>* Please fill in your name.</strong>"; document.getElementById('results').style.color='#E 6322E'; return false; }
else if (document.contact_form.email.value.search("@") == -1 || document.contact_form.email.value.search("[.*]") == -1)
{ document.getElementById('results').innerHTML = "<strong>* Please enter a valid email.</strong>"; document.getElementById('results').style.color='#E 6322E'; return false; }
else if (document.contact_form.message.value == "")
{ document.getElementById('results').innerHTML = "<strong>* Please fill in your Message.</strong>"; document.getElementById('results').style.color='#E 6322E'; return false; }
else
{ document.getElementById('results').innerHTML = "<strong>Sending message....</strong>"; document.getElementById('results').style.color='#E 6322E';document.contact_form.submit(); return true; }
}
--------------------------------------------------------------------------------
The PHP script:
PHP:
--------------------------------------------------------------------------------
$YourEmail = 'email@domainname.com';
$date = gmdate("D dS M,Y h:i a");
$content="
Webmail Message
From: $name
Email: $email
Tel No: $number
Message:
$message
==============================
This email was generated on $date
";
mail($YourEmail, "Webmail from $name", $content, "From: $email");
print "Thankyou for your email"
Comment