0

I am relatively new to html and PHP, and have a problem which I can't seem to get around.

Basically, I have a table and want to have within one of the cells a submit button that will take the user to another page where they can edit that row.

I have all of the machinery for this in place, apart from the fact that I can't get the button to send the user to the new page, it just posts the variable to the same page.

The relevant code is:

 if ($Started==0){
      $TABLE.="<td align='center' width=220><font size='2'>Evaluation not yet available.<br><br>";
      $TABLE.="<form action='request.php' method='post' style='margin:6; text-align:center;'><INPUT TYPE='submit' NAME='toedit' VALUE='Edit'></FORM>";
    } 

Where request.php is another page (which is working, and another form button (a link) works fine with this button. On submitting, however, the page with the submit button reloads with the extra text:
?Run_form_in=420&toedit=Edit in the address.

Started is just a condition set at either 0 or 1, and works fine.

Thanks in advance!

1
  • 2
    Is there a parent <form> tag that encloses this? Commented Sep 4, 2010 at 18:50

2 Answers 2

1

Change your form method from POST to GET in the third line and the problem will be solved:

$TABLE.="<form action='request.php' method='GET' style='margin:6; text-align:center;'><INPUT TYPE='submit' NAME='toedit' VALUE='Edit'></FORM>";
Sign up to request clarification or add additional context in comments.

5 Comments

No, look at the code. The third line has <form action='request.php' method='post'
Changing it to GET gave exactly the same result - still seems to be sending it to the same page, ignoring the direction to request.php!
@user381158 did you check if there's any parent <form> tag?
Brilliant - thank you. I had an unclosed <form> from much earlier in the table. Thanks again.
@anthr I added the answer below so you accept it as an answer to your question. You are welcome anytime : )
0

Check for parent <form> tags, they cause such problems. :)

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.