Posted by John on 09/10/07 16:21
>>> I would do some validation of the POST data before sending possibly
malicious data to myself.
Can you write out how I would do validation in the code?
Thanks for all of the help so far.
Also I tried this and named it mail.php:
<?php
if (isset($_POST['Send']))
{
$to = 'primster7@gmail.com';
$subject = 'Request from Website';
$myEmail = "A new request was sent:\n";
foreach ($_POST as $key => $value)
$myEmail .= $key.". ".$value."\n";
mail ($to, $subject, $myEmail);
}
?>
with the } line but it didn't send me the email.
I have this for the form:
<form
class="cssform" action="mail.php" method="post">
<p>
<label for="user">Name:</label>
<input type="text" id="user" value="" />
</p>
<p>
<label for="emailaddress">Email Address:</label>
<input type="text" id="emailaddress" value="" />
</p>
<p>
<label for="phone">Phone Number:</label>
<input type="text" id="phone" value="" />
</p>
<p>
<label for="call">Best Time To Call:</label>
Morning:
<input type="radio" name="call" />
Afternoon:
<input type="radio" name="call" />
Night
<input type="radio" name="call" />
</p>
<p><label for="call">Subject:</label>
<select name="web">
<option value="">Website Quote</option>
<option selected value="">Tech Support</option>
</option>
</select>
<br><br><br>
<p><label for="comments">Comments:</label>
<textarea name="comments" rows="" cols=""></textarea>
<div style="margin-left: 150px;">
<input type="submit" value="Submit" />
<input type="reset" value="Reset" />
</div>
</form>
[Back to original message]
|