pitn Posted April 16, 2006 Share Posted April 16, 2006 hello, can anyone tell me what I'm doing wrong?<?php $to = "mymail@hotmail.com"; $subject = "Request"; $naam = $_POST['naam']; $telefoon = $_POST['telefoon']; $vliegtuig = $_POST['vliegtuig']; $datum = $_POST['datum']; $van = $_POST['van']; $tot = $_POST['tot']; $vraag = $_POST['vraag'] $message = "$naam + $telefoon + $vliegtuig + $datum + $van + $tot + $vraag"; mail($to,$subject,$message);?>Q1: what is correct: $_POST['naam'] or ["naam"] (' or ")Q2: $message = "$naam + $telefoon + $vliegtuig + $datum + $van + $tot + $vraag"; is + correct, or do I need to use . instead? - how can I phrase the $message better?Tx allTotal PHP newbie Quote Link to comment Share on other sites More sharing options...
Orio Posted April 16, 2006 Share Posted April 16, 2006 For Q1- Single quotes (['naam']) are right.For Q2- You cant have your message var this way.Here's a way you will see things and know what they are too:$message = "naam: ".$naam." \n telefoon: ".$telefoon." \n vliegtuig: ".$vliegtuig." \n datum: ".$datum." \n van: ".$van." \n tot: ".$tot." \n vraag: ".$vraag."Orio. Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted April 16, 2006 Share Posted April 16, 2006 Actually, for Q1 you can used either single or double quotes in most situations. The difference is that everything enclosed in single quote is treated as a literal, whereas items between double quotes are expanded.The following code snippet shows the difference:[code]<?php$test = 'one';$test_array = array('$test' => 'This entry\'s index is $test', $test => 'This entry\'s index is the value of $test which is ' . $test);echo 'This shows the value of $test_array[\'$test\']: ' . $test_array['$test'] . '<br>';echo 'This shows the value of $test_array["$test"]: ' . $test_array["$test"] . '<br>';echo '<pre>The array $test_array via print_r' . print_r($test_array,true) . '</pre>';echo '<pre>The array $test_array via var_export' . var_export($test_array,true) . '</pre>';?>[/code]Ken Quote Link to comment Share on other sites More sharing options...
pitn Posted April 17, 2006 Author Share Posted April 17, 2006 Orio & Ken,Tx for helping me out + taking the time to explain, but I'm "close, but no doughnut": after pressing 'send' on the form, it returns to the original html page (which is fine); I receive the mail, with the mailsubject, BUT the mail contents are blank (?). So no $message.<?php$naam = $_POST['naam'];$telefoon = $_POST['telefoon'];$vliegtuig = $_POST['vliegtuig'];$datum = $_POST['datum'];$van = $_POST['van'];$tot = $_POST['tot'];$vraag = $_POST['vraag'];$message = $naam; $message .= $telefoon; $message .= $liegtuig; $message .= $datum; $message .= $van;$message .= $tot; $message .= $vraag;mail('mymail@hotmail.com', 'request', $message) or die("Failure!");header ("location: Contact.htm"); ?>Any ideas? Quote Link to comment Share on other sites More sharing options...
pitn Posted April 17, 2006 Author Share Posted April 17, 2006 I put in error_reporting(E_ALL); and get the following errors:Notice: Undefined index: naam in /customers/xxxxxx.eu/xxxxxx.eu/httpd.www/sendmail.php on line 3....(for every variable, so line 3 up to line9) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.