Jump to content

Form Problem


RaythMistwalker

Recommended Posts

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?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.