tags:

views:

27

answers:

2

Hi there -

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  A: 

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>";
shamittomar
It seems to be already doing GET, and to the same page.
aularon
No, look at the code. The third line has `<form action='request.php' method='post' `
shamittomar
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!
anthr
@user381158 did you check if there's any parent `<form>` tag?
aularon
Brilliant - thank you. I had an unclosed <form> from much earlier in the table. Thanks again.
anthr
@anthr I added the answer below so you accept it as an answer to your question. You are welcome anytime : )
aularon
A: 

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

aularon