RaythMistwalker Posted July 22, 2010 Share Posted July 22, 2010 Ok after a break from php i've came back and my mum has asked me to make her a website which involves sending an email to her through form. Unfortunately I cannot test if it is working due to an error somewhere here: $randNumber = $_POST['randnumber']; echo "Entered: ".$randNumber; $realNumber = $_POST['number']; echo "<br>Actual: ".$realNumber; $to = "some@email.com"; $subject = "Cake Order"; $name = $_POST['name']; echo $name; $email = $_POST['email']; echo $email; The error validation part is: if($name == '') { $errmsg_arr[] = 'Name Missing'; $errflag = true; } if($email == '') { $errmsg_arr[] = 'Email Missing'; $errflag = true; } if( $randNumber != $realNumber ) { $errmsg_arr[] = 'Incorrect Random Number Entered into Box'; $errflag = true; } if($errflag) { $_SESSION['ERRMSG_ARR'] = $errmsg_arr; } Here is the form: <form action='order.php' method='POST'> <table> <tr><td>(*)Full Name</td><td><input type='text' name='name'> </td></tr> <tr><td>(*)Email</td><td><input type='text' name='email'></td></tr> <tr><td>(*)Phone</td><td><input type='text' name='phone'></td></tr> <tr><td>(*)Address (Street)</td><td><input type='text' name='address'></td></tr> <tr><td>(*)City</td><td><input type='text' name='city'></td></tr> <tr><td>(*)Postal Code</td><td><input type='text' name='postcode'></td></tr> <tr><td>(*)Event (What is cake for?)</td><td><input type='text' name='event'></td></tr> <tr><td>(*)Deadline Date (When cake is needed)</td><td><input type='text' name='deadline'></td></tr> <tr><td>Any Other Information:</td><td><textarea rows="9" name="extrainfo" cols="30"></textarea></td></tr> <tr><td>(*)Enter The Random Number below:<br> <? echo $randNumber; ?></td><td><input type='text' name='randnumber'></td></tr> <input type='hidden' value='<? echo $randNumber; ?>' name='number'> <tr><td></td><td><input type='submit' name='order' value='Order'> </td></tr> </table> I have excluded the working parts from the PHP code. What I have noticed is the following: In regard to the random number, the form is not processing the user inputted number (<input type='text' name='randnumber'>) but IS processing the actual one sent by the hidden input. It is not recalling a name or email at all. Any insight? Quote Link to comment Share on other sites More sharing options...
Jessica Posted July 22, 2010 Share Posted July 22, 2010 Before trying to process the code, put this at the top and see what it displays: print_r($_POST); And put that here. Quote Link to comment Share on other sites More sharing options...
RaythMistwalker Posted July 22, 2010 Author Share Posted July 22, 2010 Array ( [name] => => [phone] => 123456 [address] => 1 Internet Road [city] => WWW [postcode] => EH1 807 [event] => Test [deadline] => 23 July 2010 [extrainfo] => [randnumber] => [number] => 61930632 [order] => Order ) This is the return with test data. Reading that test data it also is not reading the extra info part Quote Link to comment Share on other sites More sharing options...
RaythMistwalker Posted July 22, 2010 Author Share Posted July 22, 2010 bump Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted July 22, 2010 Share Posted July 22, 2010 I just pasted in what you posted above, and it works for me locally. Something else is has to be causing the problem. Quote Link to comment Share on other sites More sharing options...
RaythMistwalker Posted July 23, 2010 Author Share Posted July 23, 2010 NuSphere isnt returning errors i just cant see why it isnt sending through those values :/ 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.