Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


form mailer sending blanks

This topic is 5455 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

hey guys another problem which i have googled for abotu 2 hours now and found no resolve my problem is this email script is sending blank emails: this info comes from the previous page in which all the feilds in the form are shown to the person who has entered the information , in order to check to see if they are all correct. is this the problem that they are comming from the actual form itself or am i doing somethign wrong. this needs to be finished by tomorrow so im desperate thanks ALOT of any help cza [edit] this is the code from which the info is being sent: http://calebt.recoil.net.nz/others/check2.phps (if it is any help) [edit] [edited by - cza on August 14, 2003 8:11:55 AM] [edited by - cza on August 14, 2003 8:12:18 AM]

Share this post

Link to post
Share on other sites
If your code is in the same order as you posted it, you should move the
$message = "$Q1 $Q2 $Q3 $Q4 $Q5 $Q6 $Q7 $Q8 $Q9 $Q10";
under the initialization of the vars $Q1-$Q10.

Share this post

Link to post
Share on other sites
okay sweet will try now

i thought that was abit weird but i got it off a tutorial here :


hmmm still no joy i just tryed it then

if i add ',' inbetween the $Q1 etc it send the , mark only

so the problem can only be in them :/

[edited by - cza on August 14, 2003 8:23:48 AM]

Share this post

Link to post
Share on other sites
Well then I guess your var's are empty...
Sorry I didn't look at the file you posted
You don't seem to be passing any vars to your email function...
You could pass them as
<input type="hidden" name="Q1" value="<?php echo $Q1; ?>">
and similar...

[edited by - LordLethis on August 14, 2003 8:31:45 AM]

Share this post

Link to post
Share on other sites


should i put that on the sending page or on the check page

here is how the site works

survey.php (fill ths out , click the continue button)
----takes u to
check.php (shows all your answers to make sure they are correct)
-----click send button (Which is meant to email the answers)
sent.php (just says thank u and all that)

so now where do i put the hidden things on ? on the check.php page i would say??

Share this post

Link to post
Share on other sites
thanks ALOT! bro you have potentially saved my life


i will try now and report back

Share this post

Link to post
Share on other sites
OMG!@#! this is frustrating me somewhat (welcome to the world of coding)

this is the code on my check page:

<input type="hidden" name="Q1" value="">
<input type="hidden" name="Q2" value="">
<input type="hidden" name="Q3" value="">
<input type="hidden" name="Q4" value="">
<input type="hidden" name="Q5" value="">
<input type="hidden" name="Q6" value="">
<input type="hidden" name="Q7" value="">
<input type="hidden" name="Q8" value="">
<input type="hidden" name="Q9" value="">
<input type="hidden" name="Q10" value="">

<form action="sending.php" method="post">
<input type="submit" name="submit" value="Send Survey">

(where is says value=" there is this in there "< ? php echo $Q10 ; ? >)

this is the code on the sending page:

$address = "Tamihere@world-net.co.nz";
$subject = "Survey";

$from = "geo_survey";


$message = "$Q1, $Q2, $Q3, $Q4, $Q5, $Q6, $Q7, $Q8, $Q9, $Q10";

mail($address, $subject, $message, $from);


and it still doesnt have anythign in the variables

im getting very close to just making the first submit button send the information D:

[edited by - cza on August 14, 2003 8:52:00 AM]

Share this post

Link to post
Share on other sites
Edit: Bah, it's messed up the PHP tags. I've sort of fixed it, but ignore the space after each < when a ? follows (it does make a difference in PHP), so make sure there's no space there.

Ok, here is what you want to be structuring your code as.

The first page where the user enters their survey answers wants to have a form that uses the POST method, which submits the information to your checking page.

Now, I *think* what you've done, is to just echo out the contents of $Qx on the checking page, not $_POST['Qx']. The difference is that PHP doesn't assume it should be checking the POST collection for the reference of $Qx, so instead of displaying the contents from each of your variables in the POST collection, in the hidden field values for your checking form, it's displaying nothing (another words, null) as a value.

To correct this, change your hidden form inputs on your checking page, to the following:

<input type="hidden" name="Q1" value="< ?php echo $_POST['Q1']; ?>">
<input type="hidden" name="Q2" value="< ?php echo $_POST['Q2']; ?>">

Now there's 2 things I need to point out. Firstly, double check that your form on your first survey page is using POST as it's sending method (same goes for your form on your checking page) and secondly, before outputing the contents of each POST variable, on your second form, you should validate the contents.


< ?php

/* Assume isFormSafe() is a function you've written to validate the data. */
$v_Q1 = isFormSafe($_POST['Q1']);
/* Do the same for the other question variables. */


Then on your form, instead of directly accessing the POST collection to output the information on your forms (which is dangerous and very open to exploitation), use the $v_Qx variables instead, as in:

<input type="hidden" name="Q1" value="< ?php echo $v_Q1; ?>">

Incidentally, you can echo out variables in PHP using a shorthand similar to that of ASP; example:

<input type="hidden" name="Q1" value="< ?=$_POST['Q1'];?>">

Notice there is no longer the need for "php echo" in that statement.

Hope that helps,


[edited by - hellz on August 14, 2003 10:19:30 AM]

[edited by - hellz on August 14, 2003 10:20:47 AM]

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!