Mry
Mry

Reputation: 37

passing hidden input through post is not working (PHP and html)

hi i am working on the following codes , it will take a value from a query and i want to pass the value of the variable to another php page that will do some statements .

this is my form:

  <form method="post" >    
   <input  type="hidden" name="id" value="<?php echo $orderId; ?>"  />
     <button  type="submit" class="button" name="Reorder" value="Reorder">Reorder </button>
    </form>

here is the page that will receive the data and i will extract them from the form :

extract($_POST); 
$orderId=$_POST['id'];

This is the error : Notice: Undefined index: id

Upvotes: 1

Views: 681

Answers (1)

Arischvaran
Arischvaran

Reputation: 74

Your form doesn't have an action method. According to you, the data is being sent to another page.

action = "validate.php"

And you also didn't check whether the button isset.

Upvotes: 1

Related Questions