I have a form that I want a person to fill out and over to the right side of the text field is a button to validate the users email.. my first question is how do I get the form to figure out which button i am pressing and second off how do I set a form up in a single file. kinda like if condition is true then process the form else show the form.
Below I have posted code for both the form and the processing file.
----emailme.php------
<html>
<head>
<title>Request Form</title>
</head>
<body background="img/clouds.jpg" bgproperties=fixed>
<center>
<form method=post action="sentmail.php">
<table border=0 width=75%>
<tr>
<td align=center colspan=2>
<H1 align=center>
Request Form
</H1>
</td>
</tr>
<tr>
<td align=center colspan=2>
<Q>Please fill in all fields of the form. Without all information requested your request may be delayed.</Q>
</td>
</tr>
<tr>
<td align=center>
Full Name:
</td>
<td align=left>
<input type=text name=name size=35 maxsize=35>
</td>
</tr>
<tr>
<td align=center>
E-mail Address:
</td>
<td align=left>
<input type=text name=from size=35 maxsize=50>
<? include('misc.php'); ?>
<? $validate = new misc; ?>
<? if (isset($_POST['vemail'])) $validate->validate_email($from); ?>
<input type=submit name="vemail" value="Validate!">
</td>
</tr>
<tr>
<td align=center>
Address:
</td>
<td align=left>
<textarea name=addy rows=5 cols=25></textarea>
</td>
</tr>
<tr>
<td align=center>
Pick one that you would like a copy of:
</td>
<td align=left>
<select name=item size=2>
<option value="family tree">Haire/Anderson Family Tree
<option value="obits">Obitchuaries
</select>
</td>
</tr>
<tr>
<td align=center>
Send a note if you like:
</td>
<td align=left>
<textarea name=note rows=10 cols=50></textarea>
</td>
</tr>
<tr>
<td align=center colspan=2>
<input type=submit name=submit value=Send><input type=reset value=Clear>
</td>
</tr>
</table>
</form>
</center>
</body>
</html>
----sentmail.php------
<?
echo "<HTML><BODY background=img/clouds.jpg bgproperties=fixed>";
include('misc.php');
$ask = new misc;
$message = "Kristy,
$name would like for you to send a copy of your $item to him/her.
Here is his/her contact info.
$name
$from
$addy
$name has also posted a note for you below.
$note";
$subject = $name." would like a copy of your ".$item;
$ask->set_mail("jmbllm@yahoo.com",$from,$subject,$message);
$ask->email($to,$from,$subject,$message);
//echo "<H1 align=center>Your email has been sent.</H1>";
include('inc/notify.inc');
?>
all that the include for file notify.inc is just a javascript alert saying your email has been sent.
the include for misc.php is a class where the validate_email function resides.
Thank you for your time and patience.