PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
NicEJoB
Forum Newbie
Posts: 14 Joined: Tue Jul 15, 2003 8:31 pm
Post
by NicEJoB » Sun Nov 09, 2003 8:59 pm
Below is my event creator script
Code: Select all
<!doctype html public "-//w3c//dtd html 3.2//en">
<html>
<head>
<title>MLDJ - Entertainment</title>
<meta name="GENERATOR" content="Arachnophilia 4.0">
<meta name="FORMATTER" content="Arachnophilia 4.0">
</head>
<body>
<?php
$socialcorp=$_GET['socialcorp'];
$formtype=$_GET['formcas'];
$inorout=$_GET['inout'];
$typeserv=$_GET['djkarserv'];
$lights=$_GET['lightyn'];
$form_block = "
<FORM METHOD="post" ACTION="http://site.com">
<font name="verdana" size="1">
<strong>Contact Information :</strong><br><br>
<strong>Name:</strong><br>
<INPUT type="text" NAME="sender_name" VALUE="$sender_name" SIZE=30></p><br>
<strong>E-Mail and/or Phone#:</strong><br>
<INPUT type="text" NAME="sender_email" VALUE="$sender_email" SIZE=30></p><br>
<strong>Event Information :</strong><br><br><br>
<strong>What is your event?</strong><br>
<INPUT type="text" NAME="whatevent" VALUE="$whatevent" SIZE=30></p><br>
<strong>Social or Corporate?</strong><br>
<INPUT type="radio" NAME="socialcorp" VALUE="Social"> Social<br>
<INPUT type="radio" NAME="socialcorp" VALUE="Corporate"> Corporate<br><br>
<strong>Formal, semi-formal, or casual?</strong><br>
<INPUT type="radio" NAME="formcas" VALUE="Formal"> Formal<br>
<INPUT type="radio" NAME="formcas" VALUE="semi-formal"> Semi-Formal<br>
<INPUT type="radio" NAME="formcas" VALUE="casual"> Casual<br><br>
<strong>Inside or Outside?</strong><br>
<INPUT type="radio" NAME="inout" VALUE="Inside"> Inside<br>
<INPUT type="radio" NAME="inout" VALUE="Outside"> Outside<br><br>
<strong>When will your event occur?</strong><br>
<INPUT type="text" NAME="whenoccur" VALUE="$whenoccur" SIZE=30><br><br>
<strong>How many people do you expect to come?</strong><br>
<INPUT type="text" NAME="amtpeeps" VALUE="$amtpeeps" SIZE=30><br><br>
<strong>Would you lile DJ services, Karaoke services or both?</strong><br>
<INPUT type="radio" NAME="djkarserv" VALUE="DJ Services"> DJ Services<br>
<INPUT type="radio" NAME="djkarserv" VALUE="Karaoke Services"> Karaoke Services<br>
<INPUT type="radio" NAME="djkarserv" VALUE="Both"> Both<br><br>
<strong>Would you like lighting?</strong><br>
<INPUT type="radio" NAME="lightyn" VALUE="Yes"> Yes<br>
<INPUT type="radio" NAME="lightyn" VALUE="No"> No<br><br>
<strong>What kind of price range are you looking at?</strong><br>
<INPUT type="text" NAME="prange" VALUE="$pricerange" SIZE=30><br><br>
<strong>How long will your event occur?</strong><br>
<INPUT type="text" NAME="amttime" VALUE="$amttime" SIZE=30><br><br>
<strong>Age of guests?</strong><br>
<INPUT type="text" NAME="guestage" VALUE="$guestage" SIZE=30><br><br>
<strong>Genre of music you prefer?</strong><br>
<INPUT type="text" NAME="mustype" VALUE="$mustype" SIZE=30><br><br>
<strong>Additional Comments:</strong><br>
<TEXTAREA NAME="comments" COLS=30 ROWS=5 WRAP=virtual>$comments</TEXTAREA>
<INPUT type="hidden" name="op" value="ds">
<INPUT TYPE="submit" NAME="submit" VALUE="Send" class=buttons></p>
</font>
</FORM>
";
echo "$form_block";
if ($send != "no") {
// this is the info that comes on the email when it's ok to send!
$msg .= "Client Information:\n\n";
$msg .= "Name: $sender_name\n";
$msg .= "E-Mail and/or Phone#: $sender_email\n\n";
$msg .= "Event Information:\n\n";
$msg .= "Type of event: $whatevent\n";
$msg .= "Type of event: $whatevent\n";
$msg .= "Social or Corporate: $socialcorp\n";
$msg .= "Formal, semi-formal, casual: $formtype\n";
$msg .= "Inside or Outside: $inorout\n";
$msg .= "Date of event: $whenoccur\n";
$msg .= "Amount of people: $amtpeeps\n";
$msg .= "DJ services, Karaoke services, Both: $typeserv\n";
$msg .= "Lighting: $lights\n";
$msg .= "Price range: $pricerange\n";
$msg .= "Length of event: $amttime\n";
$msg .= "Age of guests: $guestage\n";
$msg .= "Genre of music: $mustype\n";
$msg .= "Comments: $comments\n\n";
$to = "mailname@mail.com";
$subject = "MLDJ Event";
$mailheaders = "From: $sender_name\n \n";
$mailheaders .= "Reply-To: $sender_email\n\n";
mail($to, $subject, $msg, $mailheaders);
}
?>
</body>
</html>
It will mail the beginning text just fine.. "Name" and such, but it wont show $sender_name or any of the other variables.
DuFF
Forum Contributor
Posts: 495 Joined: Tue Jun 24, 2003 7:49 pm
Location: USA
Post
by DuFF » Sun Nov 09, 2003 9:08 pm
You are using POST in your form but at the top of your script you are using GET.
Change:
Code: Select all
<?php
$socialcorp=$_GET['socialcorp'];
$formtype=$_GET['formcas'];
$inorout=$_GET['inout'];
$typeserv=$_GET['djkarserv'];
$lights=$_GET['lightyn'];
?>
To this:
Code: Select all
<?php
$socialcorp=$_POST['socialcorp'];
$formtype=$_POST['formcas'];
$inorout=$_POST['inout'];
$typeserv=$_POST['djkarserv'];
$lights=$_POST['lightyn'];
?>
NicEJoB
Forum Newbie
Posts: 14 Joined: Tue Jul 15, 2003 8:31 pm
Post
by NicEJoB » Sun Nov 09, 2003 9:16 pm
sill not showing anything..
volka
DevNet Evangelist
Posts: 8391 Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger
Post
by volka » Sun Nov 09, 2003 10:15 pm
what does the script mentioned at
viewtopic.php?t=8815#65245 output on your system?
if it prints
Register Globals: Off you have to use either $_GET or $_POST for all parameter you want to fetch from the form ($_POST since the form's method is POST)
e.g.
Code: Select all
<INPUT type="text" NAME="sender_email" ...>$msg .= "Name: $sender_name\n";
Code: Select all
$msg .= "Name: $_POST[sender_name]\n";or
Code: Select all
$msg .= 'Name: ' . $_POST['sender_name'] : "\n";
viewtopic.php?t=511 and
http://php.net/register_globals will tell you why
NicEJoB
Forum Newbie
Posts: 14 Joined: Tue Jul 15, 2003 8:31 pm
Post
by NicEJoB » Sun Nov 09, 2003 10:48 pm
PHP Version: 4.3.3
Display Errors: On
Error Level: Not E_ALL
Register Globals: On
volka
DevNet Evangelist
Posts: 8391 Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger
Post
by volka » Mon Nov 10, 2003 1:17 am
hm, then could you please explain "sill not showing anything.." in more detail?
not showing anything like "nothing at all, a blank page" ?
NicEJoB
Forum Newbie
Posts: 14 Joined: Tue Jul 15, 2003 8:31 pm
Post
by NicEJoB » Mon Nov 10, 2003 6:40 am
Code: Select all
$msg .= "Name: $sender_name\n";
$msg .= "E-Mail and/or Phone#: $sender_email\n\n";
$msg .= "Event Information:\n\n";
$msg .= "Type of event: $whatevent\n";
$msg .= "Type of event: $whatevent\n";
$msg .= "Social or Corporate: $socialcorp\n";
$msg .= "Formal, semi-formal, casual: $formtype\n";
$msg .= "Inside or Outside: $inorout\n";
$msg .= "Date of event: $whenoccur\n";
$msg .= "Amount of people: $amtpeeps\n";
$msg .= "DJ services, Karaoke services, Both: $typeserv\n";
$msg .= "Lighting: $lights\n";
$msg .= "Price range: $pricerange\n";
$msg .= "Length of event: $amttime\n";
$msg .= "Age of guests: $guestage\n";
$msg .= "Genre of music: $mustype\n";
$msg .= "Comments: $comments\n\n";
when the person recieves the e-mail, all they see is
Name:
E-Mail and/or Phone#:
Event Information:
Type of event:
Social or Corporate:
etc..
twigletmac
Her Royal Site Adminness
Posts: 5371 Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK
Post
by twigletmac » Mon Nov 10, 2003 6:44 am
Have you tried the changes suggested by volka?
Mac
NicEJoB
Forum Newbie
Posts: 14 Joined: Tue Jul 15, 2003 8:31 pm
Post
by NicEJoB » Mon Nov 10, 2003 7:56 am
if it prints Register Globals: Off you have to use either $_GET or $_POST for all parameter you want to fetch from the form ($_POST since the form's method is POST)
Yes, i will try when i get home. Since globals were on i didnt bother trying. After ill try ill reply with any changes. Thx.
NicEJoB
Forum Newbie
Posts: 14 Joined: Tue Jul 15, 2003 8:31 pm
Post
by NicEJoB » Mon Nov 10, 2003 2:55 pm
ok, i just got home and i tried volkas method #1 which didnt show anything again in the e-mail, method 2 caused a parse error. ;|
NicEJoB
Forum Newbie
Posts: 14 Joined: Tue Jul 15, 2003 8:31 pm
Post
by NicEJoB » Mon Nov 10, 2003 6:00 pm
erg.. there should be no reason why this doesn't work. In theory everything looks and should work fine..
twigletmac
Her Royal Site Adminness
Posts: 5371 Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK
Post
by twigletmac » Tue Nov 11, 2003 2:59 am
Had a closer look - where does the $send variable come from here:
Mac
NicEJoB
Forum Newbie
Posts: 14 Joined: Tue Jul 15, 2003 8:31 pm
Post
by NicEJoB » Tue Nov 11, 2003 10:08 am
ah, i forgot to delete that. I had it so if any feilds were blank, then send was no. Anywaym i took that part out but its still not sending the variables...
werd..
twigletmac
Her Royal Site Adminness
Posts: 5371 Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK
Post
by twigletmac » Tue Nov 11, 2003 10:10 am
Could we see what the code currently looks like?
Mac
Saethyr
Forum Contributor
Posts: 182 Joined: Thu Sep 25, 2003 9:21 am
Location: Wichita, Kansas USA
Contact:
Post
by Saethyr » Tue Nov 11, 2003 1:00 pm
Try using $_REQUEST["varname"] I was able to get the code to work just by changing the $_GET's to $_REQUEST
My 2 bytes,
Jason