dog
12-15-2006, 01:14 AM
This is the first bit of php that I've come up with.
Could someone more experienced please take a look for me and let me know if it's all good. If it's not could you tell me what's wrong with it. Thanks ;)
Firstly the form that calls it:
<html>
<body>
<form method='post' action='password-sender.php'>
<p>Please give your details below and a reminder of the password will be sent to you.</p>
Email: <input name='email' type='text' /><br />
Name: <input name='name' type='text' /><br />
<input type='submit' />
</form>
</body>
</html>
And now password-sender.php:
<?php
//if "email" is filled out, check for "name"
if (isset($_REQUEST['email']))
{
//if "name" is filled out, send a couple of mails
if (isset($_REQUEST['name']))
{
$email = $_REQUEST['email'] ;
$subject = $_REQUEST['subject'] ;
$message = "A password reminder has been sent to <"$_REQUEST['name'] ">" $_REQUEST['email'] ;
$username = $_REQUEST['name'];
mail("webmaster@torema.com.br", "Password Reminder Requested",
$message, "From: noreply@torema.com.br";
mail($email, "Password Reminder", "Here is a reminder of your password: <br><br>
Username: "$username"<br>
Password: monkey<br>
Please login at http://torema.com.br/cases.php",
"From: noreply@torema.com.br";
}
else
//if "name" is not filled out, ask them to fill it out
{
echo "please give your name";
}
else
//if "email" is not filled out, ask them to fill it out
{
echo "please fill out an email address";
}
?>
Basically, it's a form that posts the password "monkey" to the user and the email and name of the user to me.
There are a few more questions... like how to land on another page after the form has been sent and how to get the echos appearing there...
...but for starter I'd be happy if I could just get the PHP right.
Thanks a lot for any help:)
d o g
Could someone more experienced please take a look for me and let me know if it's all good. If it's not could you tell me what's wrong with it. Thanks ;)
Firstly the form that calls it:
<html>
<body>
<form method='post' action='password-sender.php'>
<p>Please give your details below and a reminder of the password will be sent to you.</p>
Email: <input name='email' type='text' /><br />
Name: <input name='name' type='text' /><br />
<input type='submit' />
</form>
</body>
</html>
And now password-sender.php:
<?php
//if "email" is filled out, check for "name"
if (isset($_REQUEST['email']))
{
//if "name" is filled out, send a couple of mails
if (isset($_REQUEST['name']))
{
$email = $_REQUEST['email'] ;
$subject = $_REQUEST['subject'] ;
$message = "A password reminder has been sent to <"$_REQUEST['name'] ">" $_REQUEST['email'] ;
$username = $_REQUEST['name'];
mail("webmaster@torema.com.br", "Password Reminder Requested",
$message, "From: noreply@torema.com.br";
mail($email, "Password Reminder", "Here is a reminder of your password: <br><br>
Username: "$username"<br>
Password: monkey<br>
Please login at http://torema.com.br/cases.php",
"From: noreply@torema.com.br";
}
else
//if "name" is not filled out, ask them to fill it out
{
echo "please give your name";
}
else
//if "email" is not filled out, ask them to fill it out
{
echo "please fill out an email address";
}
?>
Basically, it's a form that posts the password "monkey" to the user and the email and name of the user to me.
There are a few more questions... like how to land on another page after the form has been sent and how to get the echos appearing there...
...but for starter I'd be happy if I could just get the PHP right.
Thanks a lot for any help:)
d o g