1

It was working until I tried adding this statement

<?php echo "<input type=\"hidden\" name=\"hidden1\" value=\"$id\">" ?>

I was able to get the indexnum from my form before but when I added that line nothing seems to load in the fields.

Here is the full form:

  <form name="approveform" method="POST" action="">
    <?php echo "<input type=\"hidden\" name=\"hidden1\" value=\"$id\">" ?>
    Index Number*: <input type="text" name="IndexNum">&nbsp;
    <input type="submit" value="Approve" action="">
  </form>

Its getting late and I probably need to just go to sleep but IM SO CLOSE!!! Here is the full code that processes the POST.

if($user_data['permissions'] >= 1)
{
    // If users permission is 1 or 2 they get a field for inputting the index # and a button to change the approve field from 0 to 1 may need to make a new field to record who approved it....

    //Determine if the order is already approved.  If not approved show index field and allow user to approve it with index number
    if($data2[0]['Approved'] == 1)
    {
        echo " <font color=\"green\"> Approved";
    }
    if($data2[0]['Approved'] == 0)
    {
        echo " Not Approved.  Supply an index number and click approve to authorize this order to be completed.";
        if (empty ($_POST) === false) 
        {
               $required_fields = array('IndexNum');
           foreach ($_POST as $key=>$value)
           {
             if (empty($value) && in_array($key, $required_fields) === true)
             {
            $errors[] = 'Fields marked with an asterisk are required';
            break 1;
              }
           }
           if (isset($_POST['success']) === true && empty($_POST['success']) === true)
           {
               echo 'Index has been updated and Order is now set to Approved';
           }
           else
           {
            if (empty($errors) === true)
             {
                    $indexnum=$_POST['IndexNum'];
                $approvedby=$user_data['lname'];
                $vendorid1= $_POST['hidden1'];
                echo $indexnum;
                echo $approvedby;
                echo $vendorid1;
                    //update_approved($indexnum, $approvedby, $vendorid1);
                //header('Location: index.php');
                //exit();
            }
            else if(empty($errors) === false)
            {
                echo output_errors($errors);
            }
        }
     }
     ?>         
    <form name="approveform" method="POST" action="">
      <?php echo "<input type=\"hidden\" name=\"hidden1\" value=\"$id\">" ?>
      Index Number*: <input type="text" name="IndexNum">&nbsp;
      <input type="submit" value="Approve" action="">
    </form>

    <?php } 

}

Thank you all for looking into this. I get that $id value from a previous POST. I use it elsewhere in the code without issue.

Thank you all so much!

1
  • Also ensure the $id has some value. Just do a var_dump($id); to be sure about it Commented Sep 26, 2013 at 6:22

1 Answer 1

6

Try like

<input type="hidden" name="hidden1" value="<?php echo $id;?>">

Also try like

<?php echo '<input type="hidden" name="hidden1" value=".$id.">' ?>
Sign up to request clarification or add additional context in comments.

2 Comments

@HELPMEPLEASE then please mark his answer as "Accepted", he deserves some reputation.
@AndréDaniel I dont deserve a reputation.I want to help him by answering it.Thats it.. ;-)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.