lil_apri
07-17-2003, 10:16 AM
Hi there. How to make php email forms? Please teach me!
is this the code?
I found it at the web. So if this is the code,how to put it into my website and how to make the form? E.g the questions,submit button etc.Thank you =)
_________________________
_________________________
_
<?php
$mail_from = "webmaster@stargeek.com";
$mail_path = "~/usr/sbin/sendmail -i -t";
$mail_to = "zan@stargeek.com";
$mail_subject = "Contact Form";
ini_set("sendmail_from", $mail_from);
ini_set("sendmail_path", $mail_path);
if ($_POST)
{
if($_POST['userEmail'])
{
if( mail($mail_to,$mail_subje
ct, $_POST['userName']."\n".$_POST['userEmail']. "\n". $_POST['userMessage'])) )
{
$html = 'Your email was sent';
}
else
{
$html = 'There was an error';
}
}
}
else
{
$message = '<textarea name="userMessage"></textarea>';
$name = '<input type="text" name="userName">';
$reply = '<input type="text" name="userEmail">';
$send = '<input type="submit" name="submit" value="Send">';
$html = "
<p>
To Contact Stargeek:
</p>
<form action=\"$PHP_SELF\" method=\"post\">
<table class=\"bodyBlack\" border=\"0\" cellspacing=\"5\">
<tr>
<td>Your Name:$name</td>
<td>Your Email:$reply</td>
</tr>
<tr>
<td colspan=\"2\" align=\"center\">Additional Message</td>
</tr>
<tr>
<td colspan=\"2\" align=\"center\">$message</td>
</tr>
<tr>
<td colspan=\"2\" align=\"center\">$send</td>
</tr>
</table>
</form>
";
}
?>
<html>
<head>
</head>
<body>
<?=$html?>
</body>
</html>
Please use the Edit button instead of replying within 5 minutes of posting
-Moderator
is this the code?
I found it at the web. So if this is the code,how to put it into my website and how to make the form? E.g the questions,submit button etc.Thank you =)
_________________________
_________________________
_
<?php
$mail_from = "webmaster@stargeek.com";
$mail_path = "~/usr/sbin/sendmail -i -t";
$mail_to = "zan@stargeek.com";
$mail_subject = "Contact Form";
ini_set("sendmail_from", $mail_from);
ini_set("sendmail_path", $mail_path);
if ($_POST)
{
if($_POST['userEmail'])
{
if( mail($mail_to,$mail_subje
ct, $_POST['userName']."\n".$_POST['userEmail']. "\n". $_POST['userMessage'])) )
{
$html = 'Your email was sent';
}
else
{
$html = 'There was an error';
}
}
}
else
{
$message = '<textarea name="userMessage"></textarea>';
$name = '<input type="text" name="userName">';
$reply = '<input type="text" name="userEmail">';
$send = '<input type="submit" name="submit" value="Send">';
$html = "
<p>
To Contact Stargeek:
</p>
<form action=\"$PHP_SELF\" method=\"post\">
<table class=\"bodyBlack\" border=\"0\" cellspacing=\"5\">
<tr>
<td>Your Name:$name</td>
<td>Your Email:$reply</td>
</tr>
<tr>
<td colspan=\"2\" align=\"center\">Additional Message</td>
</tr>
<tr>
<td colspan=\"2\" align=\"center\">$message</td>
</tr>
<tr>
<td colspan=\"2\" align=\"center\">$send</td>
</tr>
</table>
</form>
";
}
?>
<html>
<head>
</head>
<body>
<?=$html?>
</body>
</html>
Please use the Edit button instead of replying within 5 minutes of posting
-Moderator