Gazza_NZ Posted April 11, 2008 Share Posted April 11, 2008 hi, i've got some code for an assignment that, as far as i'm aware, should work fine. BUT... it won't display the next page when button clicked like it should anyone got any ideas why? i'm stumped $self = $_SERVER['PHP_SELF]; echo("<form action = '$self' method = 'POST'>"); //code here echo("<td><input type = 'checkbox' name = 'remove[]' value = '$name'> Delete $name</td>"); echo("</tr>"); } echo("<tr>"); echo("<td colspan = '6'><input type = 'submit' name = 'removeData' value = 'Delete Pet Records'></td>"); echo("</tr>"); echo("</table>"); echo("</form>"); } else if(isset($_POST['enterData'])){ // more code here any help greatly appreciated Gazza Link to comment https://forums.phpfreaks.com/topic/100568-urgent-can-anyone-see-why-this-wont-work/ Share on other sites More sharing options...
Liquid Fire Posted April 11, 2008 Share Posted April 11, 2008 kinda hard to tell when 90% of that code is just echoing. Link to comment https://forums.phpfreaks.com/topic/100568-urgent-can-anyone-see-why-this-wont-work/#findComment-514336 Share on other sites More sharing options...
AndyB Posted April 11, 2008 Share Posted April 11, 2008 BUT... it won't display the next page when button clicked like it should ... There is no NEXT page. The form posts to itself. Link to comment https://forums.phpfreaks.com/topic/100568-urgent-can-anyone-see-why-this-wont-work/#findComment-514339 Share on other sites More sharing options...
Gazza_NZ Posted April 11, 2008 Author Share Posted April 11, 2008 kinda hard to tell when 90% of that code is just echoing. sorry, but unless you want to see the whole lot... (not recommended, its not the neatest code around) all its got is a checkbox and a button in a table, the form is self referencing, the button name is the same as in the isset... it should work right? all the others do Link to comment https://forums.phpfreaks.com/topic/100568-urgent-can-anyone-see-why-this-wont-work/#findComment-514340 Share on other sites More sharing options...
Gazza_NZ Posted April 11, 2008 Author Share Posted April 11, 2008 BUT... it won't display the next page when button clicked like it should ... There is no NEXT page. The form posts to itself. self referencing form, $_POST will have a value set when the button is clicked, and it should skip over previous code to the part i'm wanting to display. i know that much, because it works with other parts of the page Link to comment https://forums.phpfreaks.com/topic/100568-urgent-can-anyone-see-why-this-wont-work/#findComment-514342 Share on other sites More sharing options...
AndyB Posted April 11, 2008 Share Posted April 11, 2008 What exactly if your definition of "work right". No, we don't want to see all the code, but it might be worth posting the code that's relevant to whatever doesn't work the way you expect, especially when "all the others do" (which is particularly cryptic in the context of the questions you've posed. Link to comment https://forums.phpfreaks.com/topic/100568-urgent-can-anyone-see-why-this-wont-work/#findComment-514344 Share on other sites More sharing options...
Gazza_NZ Posted April 11, 2008 Author Share Posted April 11, 2008 just noticed i got the wrong bit of code up there... echo("<td colspan = '6'><input type = 'submit' name = 'modifyData' value = 'Edit This Pet'></td>"); //code to finish table and form } else if(isset($_POST['modifyData'])){ thats the part not working... Link to comment https://forums.phpfreaks.com/topic/100568-urgent-can-anyone-see-why-this-wont-work/#findComment-514345 Share on other sites More sharing options...
Gazza_NZ Posted April 11, 2008 Author Share Posted April 11, 2008 What exactly if your definition of "work right". No, we don't want to see all the code, but it might be worth posting the code that's relevant to whatever doesn't work the way you expect, especially when "all the others do" (which is particularly cryptic in the context of the questions you've posed. sorry, new here, assignment's due in 4 hrs, working on getting extra marks... by "work right" I mean it should display the next section appropriate to the button. by "all the others do" I mean that on other parts of the page I do the same thing, self referencing form that when a button is clicked, it displays a different "page" to the "page" that was up before the button was clicked Link to comment https://forums.phpfreaks.com/topic/100568-urgent-can-anyone-see-why-this-wont-work/#findComment-514347 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.