Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using a form to send info via e-mail problems.. 1

Status
Not open for further replies.

help120

Technical User
Apr 15, 2001
198
US
I've 2 pages challenge.html and send.php. When I attempt to use my form to take and process info that will be sent via e-mail I get the following error.

(this is only half of the errors.. but the rest is the same stuff)

Notice: Undefined variable: sender_name in C:\Inetpub\finalphase\neverplaysober\v4\send.php on line 3

Notice: Undefined variable: sender_clanname in C:\Inetpub\finalphase\neverplaysober\v4\send.php on line 4

Notice: Undefined variable: sender_email in C:\Inetpub\finalphase\neverplaysober\v4\send.php on line 5

Notice: Undefined variable: sender_aim in C:\Inetpub\finalphase\neverplaysober\v4\send.php on line 6

Notice: Undefined variable: sender_date in C:\Inetpub\finalphase\neverplaysober\v4\send.php on line 7


Challenge.html (code)
-----------------------------------------------------------
<FORM method=&quot;POST&quot; action=&quot;send.php&quot;>
<P>Your Name:<br>
<INPUT type=&quot;text&quot; name=&quot;sender_name&quot; size=30>
</p>
<P>Your Clans Name:<br>
<INPUT type=&quot;text&quot; name=&quot;sender_clanname&quot; size=30>
</p>
<P>Your E-Mail Address:<br>
<INPUT type=&quot;text&quot; name=&quot;sender_email&quot; size=30>
</p>
<P>Your AOL IM name:<br>
<INPUT type=&quot;text&quot; name=&quot;sender_aim&quot; size=30>
</p>
<P>What Day would you like the match to be?<br>
<INPUT type=&quot;text&quot; name=&quot;sender_date&quot; size=30>
</p>
<P>What time would you like the match to be?<br>
<INPUT type=&quot;text&quot; name=&quot;sender_time&quot; size=30>
</p>
<P>Game to be played:<br>
<select size=&quot;1&quot; name=&quot;sender_game&quot;>
<option>JK2</option>
<option>HL-cs</option>
<option>HL-DoD</option>
<option>HL-tfc</option>
<option>RTCW</option>
<option>Battle Net</option>
<option>Sven-Coop</option>
</select>
</p>
<P>Number of Players?<br>
<INPUT type=&quot;text&quot; name=&quot;sender_players&quot; size=30>
</p>
<P>Map 1<br>
<INPUT type=&quot;text&quot; name=&quot;sender_map1&quot; size=30>
</p>
<P>Map 2<br>
<INPUT type=&quot;text&quot; name=&quot;sender_map2&quot; size=30>
</p>
<INPUT type=&quot;submit&quot; value=&quot;Send This Form&quot;>
</FORM>
-----------------------------------------------------------



send.php (code)
-----------------------------------------------------------
<?php

$msg = &quot;Sender Name:\t$sender_name\n&quot;;
$msg .= &quot;Your Clans Name:\t$sender_clanname\n&quot;;
$msg .= &quot;Sender E-Mail:\t$sender_email\n&quot;;
$msg .= &quot;Your AOL IM name:\t$sender_aim\n&quot;;
$msg .= &quot;What Day would you like the match to be?\t$sender_date\n&quot;;
$msg .= &quot;What time would you like the match to be?\t$sender_time\n&quot;;
$msg .= &quot;Game to be played:\t$sender_game\n&quot;;
$msg .= &quot;Map 1\t$sender_map1\n&quot;;
$msg .= &quot;Map 2\t$sender_map2\n&quot;;


$recipient = &quot;venom@neverplaysober.com&quot;;
$subject = &quot;Challenge NPS&quot;;

$mailheaders = &quot;From: Never Play Sober Challenge Form <> \n&quot;;
$mailheaders .= &quot;Reply-To: $sender_email\n\n&quot;;

mail($recipient, $subject, $msg, $mailheaders);

echo &quot;<HTML><HEAD><TITLE>Form Sent!</TITLE></HEAD><BODY>&quot;;
echo &quot;<H1 align=center>Thank You, $sender_name</H1>&quot;;
echo &quot;<P align=center>Your feedback has been sent.</P>&quot;;
echo &quot;</BODY></HTML>&quot;;

?>
------------------------------------------------------------


Link
 
O, I get the e-mail just not any of the info I've typed into the fields.

ex.
Sender Name:
Your Clans Name:
Sender E-Mail:
Your AOL IM name:
What Day would you like the match to be?
What time would you like the match to be?
Game to be played:
Map 1
Map 2
 
works just fine for me, beware tho I dunno if my test box might send you some spam :) ***************************************
Party on, dudes!
[cannon]
 
at the top of your send code try this for all the passed variables:

$sender_name=$HTTP_POST_VARS['sender_name'];

HTH,
Clive
 
cool.. works now.. but is their a way to stop refreshing the send.php page?
 
Like if you submit the form it takes you to send.php and submits the info to my e-mail. Now if you refresh send.php it will send the info to my e-mail again. I'm just worried I might get allot of spammers.
 
Well you could send them to a new page for the thank you message or you could change the mail variables to blank I suppose.
 
I know in asp you can do multiple pages like index.asp?page=1 using the following code..

<% IF Len(Request.QueryString(&quot;page&quot;))=0 THEN %>
This is some text
<% ELSEIF Request.QueryString(&quot;page&quot;)=&quot;1&quot; THEN %>
more text
<% end if %>

Is their a way to do this using php?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top