Page 1 of 2

Wont send variables..

Posted: Sun Nov 09, 2003 8:59 pm
by NicEJoB
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.

Posted: Sun Nov 09, 2003 9:08 pm
by DuFF
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']; 
?>

Posted: Sun Nov 09, 2003 9:16 pm
by NicEJoB
sill not showing anything..

Posted: Sun Nov 09, 2003 10:15 pm
by volka
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

&lt;INPUT type="text" NAME="sender_email"  ...&gt;
$msg .= "Name: $sender_name\n";
:arrow:

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

Posted: Sun Nov 09, 2003 10:48 pm
by NicEJoB
PHP Version: 4.3.3
Display Errors: On
Error Level: Not E_ALL
Register Globals: On

Posted: Mon Nov 10, 2003 1:17 am
by volka
hm, then could you please explain "sill not showing anything.." in more detail?
not showing anything like "nothing at all, a blank page" ?

Posted: Mon Nov 10, 2003 6:40 am
by NicEJoB

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..

Posted: Mon Nov 10, 2003 6:44 am
by twigletmac
Have you tried the changes suggested by volka?

Mac

Posted: Mon Nov 10, 2003 7:56 am
by NicEJoB
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.

Posted: Mon Nov 10, 2003 2:55 pm
by NicEJoB
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. ;|

Posted: Mon Nov 10, 2003 6:00 pm
by NicEJoB
erg.. there should be no reason why this doesn't work. In theory everything looks and should work fine..

Posted: Tue Nov 11, 2003 2:59 am
by twigletmac
Had a closer look - where does the $send variable come from here:

Code: Select all

f ($send != "no") {
Mac

Posted: Tue Nov 11, 2003 10:08 am
by NicEJoB
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..

Posted: Tue Nov 11, 2003 10:10 am
by twigletmac
Could we see what the code currently looks like?

Mac

Posted: Tue Nov 11, 2003 1:00 pm
by Saethyr
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