leefentress Posted February 9, 2009 Share Posted February 9, 2009 I just noticed that I forgot to write all the variables to store POST data in, and yet my script is still processing the data sent from this form. How does it know how to do this when I only wrote the code to store the first three fields? Quote Link to comment https://forums.phpfreaks.com/topic/144512-hows-my-script-working-when-i-forgot-to-write-part-of-the-code-lol/ Share on other sites More sharing options...
Maq Posted February 9, 2009 Share Posted February 9, 2009 I just noticed that I forgot to write all the variables to store POST data in, and yet my script is still processing the data sent from this form. How does it know how to do this when I only wrote the code to store the first three fields? I don't know. Could we see some code? Quote Link to comment https://forums.phpfreaks.com/topic/144512-hows-my-script-working-when-i-forgot-to-write-part-of-the-code-lol/#findComment-758333 Share on other sites More sharing options...
leefentress Posted February 9, 2009 Author Share Posted February 9, 2009 See I forgot to go back and write the stuff for everything after $email = $_POST["email"]; yet everything works. I've since gone back and went ahead and added the rest of the stuff that's sposta be there. Does php have some kind of thing built in where if you're referencing a variable that hasn't been defined, it looks in the post data to see if there's something with the same name? <?php $fName = $_POST["fName"]; $lName = $_POST["lName"]; $email = $_POST["email"]; $curlPost = 'entry.0.single=' . urlencode($fName) . '&entry.1.single=' . urlencode($lName) . '&entry.2.single=' . urlencode($email) . '&entry.3.single=' . urlencode($party) . '&entry.4.single=' . urlencode($email2) . '&entry.5.single=' . urlencode($phone) . '&entry.6.single=' . urlencode($address) . '&entry.7.single=' . urlencode($state) . '&entry.8.single=' . urlencode($city) . '&entry.9.single=' . urlencode($zip) . '&entry.11.single=' . urlencode($comments) . '&SUBMIT=Submit'; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'http://spreadsheets.google.com/formResponse?key=...'); curl_setopt($ch, CURLOPT_HEADER, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $curlPost); $data = curl_exec($ch); curl_close($ch); $to = $email; $subject = 'Thank you for registering for the Heart for Israel Conference'; $message = "Dear $fName,\n\nThank you for registering. We have received your information and look forward to seeing you at the conference.\n\nShalom,\nHeart for Israel"; $headers = 'From: rsvp@---.com' . "\r\n" . 'Reply-To: support@---.com' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); $message = wordwrap($message, 70); mail($to, $subject, $message, $headers); echo "<p>Thank you for registering! We look forward to seeing you at the conference. An email has been sent to $email confirming your RSVP.</p> <p>First Name: $fName </p> <p>Last Name: $lName </p> <p>Email: $email </p> <p>Phone: $phone </p> <p>Address: <br /> $address <br /> $city, $state $zip </p> <p>Party: $party </p> <p>Comments: $comments </p> "; ?> Quote Link to comment https://forums.phpfreaks.com/topic/144512-hows-my-script-working-when-i-forgot-to-write-part-of-the-code-lol/#findComment-758336 Share on other sites More sharing options...
PFMaBiSmAd Posted February 9, 2009 Share Posted February 9, 2009 What does a phpinfo() statement show for register_globals? If this setting is on (7 years after it was turned off by default in php4.2), you should not rely on it, you should turn it off if possible (due to the security risk), and it has been completely removed in php6. Quote Link to comment https://forums.phpfreaks.com/topic/144512-hows-my-script-working-when-i-forgot-to-write-part-of-the-code-lol/#findComment-758396 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.