1

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

9
  • This wouldn't submit a user to another page. How are you sending the user to the page? Don't use extract. Commented Dec 18, 2021 at 23:42
  • @user3783243 i am not sending the user to another page , the second page will just get the data to do some statements , and since it is a form and i need to do something on it , it must to use a method like get or post Commented Dec 18, 2021 at 23:46
  • I don't follow. You contradict yourself in the comment, and in the body of the question. i am not sending the user to another page <> the second page will just get the data, nor i want to pass the value of the variable to another php page.. so there is only 1 page or 2 pages?? If 2 as you state multiple times how/when does the user get there? Commented Dec 18, 2021 at 23:49
  • in page 1 : the user will not enter any data he/she will just click the button and in the second php page will receive the hidden input value to do some statements Commented Dec 18, 2021 at 23:54
  • 1
    <form method="post" > will not send the user anywhere. Are you sending the user to the next page with JS or how do they get there? Commented Dec 19, 2021 at 0:06

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

Comments

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.