Beginner needing help...
| From: | ScreamKing | Date: | Wed, 27 Dec 2000 06:05:19 +0000 |
| Subject: | Beginner needing help... | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-31921@lists.php.net to get a copy of this message | ||
Hi All,
This is my first post, and currently my first day in PHP. I've managed to write a form script,
but was wondering how to add an automatic reply. There's a few other questions I have, but
this is the main one that's bugging me.
Basically I want to create an automated reply to all submissions. I would also like to know how to
get the IP and Browser Type sent to my email (I tried it a couple of times, but it kept returning
the variable for some reason).
I've got two pieces as shown below (The HTML and the PHP file)
HTML file:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<TITLE>Transfer Form</TITLE>
<BODY>
<FORM METHOD="POST" action="do_sendfeedback2.php">
<P>Your Manager Name: <br><INPUT type="text" name="sender_name"
size=30></P>
<P>Your E-Mail Address: <br><INPUT type="text"
name="sender_email" size=30></P>
<P>Your Club: <br><INPUT type="text" name="club_name"
size=30></P>
<P>Player in Question: <br><INPUT type="text" name="player_name"
size=30></P>
<P>Player's primary position: <SELECT size="1">
<option selected name="position"
value="goalkeeper">Goalkeeper</option>
<option name="position" value="defender">Defender</option>
<option name="position" value="midfielder">Midfielder</option>
<option name="position" value="striker">Striker</option>
</select>
<P>Player's current club: <br><INPUT type="text"
name="player_club" size=30></P>
<P>Your current bid: <br><INPUT type="text" name="bid" size=5>
million. (E.g. 1.0 for £1m, 0.4m for £0.4m)</P>
<P>Transfer type?
<INPUT type="radio" name="transfer_type" value="Purchase"
checked> Transfer Purchase
<INPUT type="radio" name="transfer_type" value="Sale"> Transfer
Sale
</P>
<P>Additional Message: <BR>
<textarea name="message" cols=30 rows=5></textarea>
</P>
<INPUT type="submit" value="Submit Transfer Form">
</FORM>
</BODY>
PHP file:
<?php_trackvars?>
<!-- ensures variables are tracked -->
<?php
$msg = "Sender's Full Name:\t$sender_name\n";
$msg .= "Sender's E-Mail?\t$sender_email\n";
$msg .= "Transfer Type:\t$transfer_type\n";
$msg .= "Player's Name:\t$player_name\n";
$msg .= "Current Club:\t$player_club\n";
$msg .= "New Club:\t$club_name\n";
$msg .= "Transfer Fee:\t£$bid million\n";
$msg .= "Additional Message:\t$message\n";
// use two newline characters at the end of your content for addtional spacing
$mailheaders = "From: $sender_email\n";
$mailheaders .= "Reply-To: $sender_email\n\n";
mail(goodfella_gf@hotmail.com, "Transfer Form", $msg, $mailheaders);
echo "<H1 align=center>Thank You, $sender_name</H1>";
echo "<P align=center>The details of your transfer have been passed onto the Soccer All
Stars Executive Board<br>The deal should be completed within the next two
days.</P>";
echo "<br><br>";
echo "For a reference, the details of your transaction can be found below:</P>";
echo "<B>Name:</B> $sender_name.<BR>";
echo "<B>Email:</B> $sender_email.<BR><BR>";
echo "<B>TRANSFER DETAILS</B><BR>";
if ($transfer_type == "Purchase") {
echo "Your club $club_name have made a £$bid million bid for $player_club player
$player_name.<br>";
echo "This transfer can only be completed once $player_club submit an identical transfer
form.<br>";
} else {
echo "Your club $club_name have accepted a £$bid million bid for
$player_name.<br>";
}
echo "<P>For security reasons, the following information has been logged and submitted to
the Executive Board for verification and validitation.</P>";
$remote_address = getenv("REMOTE_ADDR");
echo "Your IP address is $remote_address.<br>";
$browser_type = getenv("HTTP_USER_AGENT");
echo "You are using $browser_type.<br>";
?>
I would appreciate any help, or if someone could point me in the direction to find help myself. I
know my code isn't the greatest yet - so any help at all would be accepted :)
Thanks a million.
SK