Posts: 73
Location: San Jose, California
|
Okay I'm new to PHP/MySQL...Somewhat xD I know a lot cause of C++ and stuff but the MySQL part is all crazy for me.
Anyways before I start asking questions about MySQL I want to get this simple e-mail form down.
Theres two things I want:
1. To have the 'from' say their e-mail address when sent, and have the Subject show...the subject when it comes in my e-mail.
2. I want a "Message has been succesfully sent" Appear above the e-mail form, but fade in like when you digg something on digg I guess is the best example.
Heres the code so far.
Code:
<td class="newsbody"><table width="100%" border="1">
<tr>
<td><?php
//Variable Definitions from contact.php
$subject = $_POST['subject'];
$message = $_POST['message'];
$email = $_POST['email'];
$name = $_POST['name'];
$header ="From $name <$email>";
$to = 'email@email.net';
//send the e-mail
$send_contact = mail($to,$subject,$message,$header);
if($send_contact) { //Checks if E-mail was sent succesfully
echo "Message has been sent Succesfully";
} else {
echo "Error recieving Message";
}
?></td>
</tr>
</table>
<form id="form1" name="form1" method="post" action="contact.php">
<table width="100%" border="0" cellpadding="3">
<tr>
<td width="25%"><label>
<input name="Name" type="text" class="tbl" id="Name" />
</label>
<label></label></td>
<td width="75%">Name</td>
</tr>
<tr>
<td><input name="email" type="text" class="tbl" id="email" /></td>
<td>E-mail</td>
</tr>
<tr>
<td><input name="subject" type="text" class="tbl" id="subject" /></td>
<td>Subject</td>
</tr>
<tr>
<td colspan="2"><textarea name="message" cols="45" rows="8" class="tbl" id="message">Enter Message here...</textarea></td>
</tr>
<tr>
<td colspan="2"><input type="submit" name="submit" id="submit" value="Submit" />
<label>
<input type="reset" name="Reset" id="button" value="Reset" />
</label></td>
</tr>
</table>
<label></label>
<br />
</form> </td>
</tr>
</table>
I think the fade in prob needs ajax or something? still the table is always showing even before they sent the message...and ya :/
Last edited by l3lueMage; 10-18-2007 at 01:56 PM..
|