Jump to content

Can't submit the form inside Echo function


hoangthi
Go to solution Solved by jazzman1,

Recommended Posts

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: 


 

Thank you for reading and sorry for my bad English!

Edited by hoangthi
Link to comment
Share on other sites

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

Edited by hoangthi
Link to comment
Share on other sites

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!

Link to comment
Share on other sites

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 by hoangthi
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.