hoangthi Posted October 4, 2013 Share Posted October 4, 2013 (edited) Hello everyone. I have a problem about HTML form and I need your help This is my code: echo "<form name=\"form1\" method=\"post\" action=\"spend.php?ref={$_GET['ref']}&action=sth\"> <input name=\"bet\" value=\"Something\" type=\"radio\">SomeThing <input name=\"bet\" value=\"Something\" type=\"radio\">SomeThing <input name=\"Submit\" value=\"Press to submit\" type=\"submit\">" I dont understand why I can't submit the form when clicking the submit button. The browser doesn't goto spend.php page, It shows me 404 not found and Redirects to index page (I use .htaccess) This is my live code online: http://dragonace.info/bomb/bombcutting.php?action=defuse Thank you for reading and sorry for my bad English! Edited October 4, 2013 by hoangthi Quote Link to comment https://forums.phpfreaks.com/topic/282707-cant-submit-the-form-inside-echo-function/ Share on other sites More sharing options...
Ch0cu3r Posted October 4, 2013 Share Posted October 4, 2013 The form is submitting to submit.php. The code you posted is fine and is outputting the form. Something somewhere else is causing this, most likely with your .htaccess. Disable the htaccess and see what spend.php is doing. Quote Link to comment https://forums.phpfreaks.com/topic/282707-cant-submit-the-form-inside-echo-function/#findComment-1452560 Share on other sites More sharing options...
hoangthi Posted October 4, 2013 Author Share Posted October 4, 2013 (edited) The form is submitting to submit.php. The code you posted is fine and is outputting the form. Something somewhere else is causing this, most likely with your .htaccess. Disable the htaccess and see what spend.php is doing. Yeah. I disable the .htaccess and of course, the browser goes to the 404 page. I don't understand why... This is my demo http://dragonace.info/bomb/bombcutting.php?action=defuse Please view source it to help me Edited October 4, 2013 by hoangthi Quote Link to comment https://forums.phpfreaks.com/topic/282707-cant-submit-the-form-inside-echo-function/#findComment-1452561 Share on other sites More sharing options...
Ch0cu3r Posted October 4, 2013 Share Posted October 4, 2013 The form is submitting to submit.php. Sorry meant to say spend.php But where is spend.php is it in the same folder as bombcutting.php? Quote Link to comment https://forums.phpfreaks.com/topic/282707-cant-submit-the-form-inside-echo-function/#findComment-1452562 Share on other sites More sharing options...
hoangthi Posted October 4, 2013 Author Share Posted October 4, 2013 Sorry meant to say spend.php But where is spend.php is it in the same folder as bombcutting.php? My English is so bad but I see Of course, spend.php is in bomb folder and in the same folder as bombcutting.php Quote Link to comment https://forums.phpfreaks.com/topic/282707-cant-submit-the-form-inside-echo-function/#findComment-1452564 Share on other sites More sharing options...
Solution jazzman1 Posted October 4, 2013 Solution Share Posted October 4, 2013 Can you show us the script of the spend.php file? Is there a php header() function inside this file? Quote Link to comment https://forums.phpfreaks.com/topic/282707-cant-submit-the-form-inside-echo-function/#findComment-1452568 Share on other sites More sharing options...
hoangthi Posted October 4, 2013 Author Share Posted October 4, 2013 Can you show us the script of the spend.php file? Is there a php header() function inside this file? Yeah There is no header function here. This is my code <? if ($_GET['action'] == "defuse") { echo "<td></td> <td> <div align=\"center\"><img src=\"http://i.imgur.com/NCQHDzV.jpg\" alt=\"C4 TNT\" width=\"319\" height=\"121\"> </div></td> <div align=\"center\" class=\"style1\">Select the line that you want to cut! </div></td> <td><form name=\"form1\" method=\"post\" action=\"spend.php?ref={$_GET['ref']}&action=defuse\"> <table border=\"0\" cellpadding=\"2\" cellspacing=\"0\" style=\"width:100%\"> <tbody><tr align=\"center\"> </tr> <tr align=\"center\"> <td align=\"center\"><font size=\"2\" face=\"Arial, Helvetica, sans-serif\"><strong> <input name=\"bet\" value=\"blackline\" checked=\"checked\" type=\"radio\"> <sy2>BLACK LINE</sy2></strong></font></td> <td align=\"center\"><font size=\"2\" face=\"Arial, Helvetica, sans-serif\"><strong> <input name=\"bet\" value=\"redline\" type=\"radio\"> <sy1>RED LINE</sy1></strong></font></td> </tr> </tbody></table> <p align=\"center\"> <input name=\"Submit\" value=\"Press to Desufe the Bomb\" type=\"submit\"> </p> </form></td> "; exit(); } ?> Please help me please! Quote Link to comment https://forums.phpfreaks.com/topic/282707-cant-submit-the-form-inside-echo-function/#findComment-1452569 Share on other sites More sharing options...
jazzman1 Posted October 4, 2013 Share Posted October 4, 2013 Does you hosting allows you to use opening php short tags "<?" instead of "<?php"? Why are you using exit() on the bottom? It terminates execution of the scrip ??? Quote Link to comment https://forums.phpfreaks.com/topic/282707-cant-submit-the-form-inside-echo-function/#findComment-1452571 Share on other sites More sharing options...
hoangthi Posted October 4, 2013 Author Share Posted October 4, 2013 (edited) Does you hosting allows you to use opening php short tags "<?" instead of "<?php"? Why are you using exit() on the bottom? It terminates execution of the scrip ??? Thanks, bombcutting.php is history table, but bombcutting.php?action=defuse is that code (#7), so I use exit () to show only defuse page, not history table Edited October 4, 2013 by hoangthi Quote Link to comment https://forums.phpfreaks.com/topic/282707-cant-submit-the-form-inside-echo-function/#findComment-1452573 Share on other sites More sharing options...
hoangthi Posted October 4, 2013 Author Share Posted October 4, 2013 Oh yes, Thank you jazzman1, The problem has been resolved, I found a header() in spend file. Quote Link to comment https://forums.phpfreaks.com/topic/282707-cant-submit-the-form-inside-echo-function/#findComment-1452579 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.