JamesThePanda Posted January 15, 2010 Share Posted January 15, 2010 Hi Im having a problem with some code Im not sure if its a php thing or a html thing. Basically I have been making a wordpress plugin, In the plugin there is a form, all it is ment to do is. delete a row of a table in a data base all is working fine apart from one thing the delete button. More specifically the action of the form, i have tried to get the form to submit to its self by setting the target as the specific php file. How can i check If the file is actually submitting to its self. Thanks James Link to comment https://forums.phpfreaks.com/topic/188564-submitting-form-to-self-problem/ Share on other sites More sharing options...
deansatch Posted January 15, 2010 Share Posted January 15, 2010 put this at the top of the page in question (assuming you have a 'submit' named input)? if (isset($_POST['submit'])) {echo 'it is posting to itself fine';} Link to comment https://forums.phpfreaks.com/topic/188564-submitting-form-to-self-problem/#findComment-995527 Share on other sites More sharing options...
Rizla Posted January 15, 2010 Share Posted January 15, 2010 example form code: <form method="post" action="pagename.php"> <input type="submit" name="submit" value="Delete" /> </form> Just make shure the php code is listening to the correct submit btn "name" and make shure the php code that deletes receives the correct row id otherwhise you wont be able to delete anything. Can you post your code??? Link to comment https://forums.phpfreaks.com/topic/188564-submitting-form-to-self-problem/#findComment-995543 Share on other sites More sharing options...
Buddski Posted January 15, 2010 Share Posted January 15, 2010 You can always use the server global's request_uri as your action echo '<form action="'.$_SERVER['REQUEST_URI'].'" method="post">'; Link to comment https://forums.phpfreaks.com/topic/188564-submitting-form-to-self-problem/#findComment-995553 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.