vdo Posted August 2, 2010 Posted August 2, 2010 Hi! Why does not work this simple php code on heliohost.org? On my localhost it works fine. The problem is that the submit button doesnt post data to calculate and to show in input box. Thanks for help. <html> <head> <title>tutorial</title> <meta http-equiv="Content-Type" content="text/html; charset=windows-1250"> </head> <body> <? if ($km > 0) $m = $km * 1000; ?> <form method=POST> //i try too method=GET and it failed too <table align="center" rules="none" cellpadding=5 bgcolor="#0563A5"> <tr><th colspan=2><font color="#FFFFFF">tutorial</font></th></tr> <tr><td><input type=text name="km" size=20 value="<? echo $km; ?>">km</td> <td> <input type=text name=m size=20 value="<? echo $m; ?>"> m</td></tr> <tr><th colspan=2><input type=submit value="calc"></th></tr> </table> </form> </body> </html> Quote
Byron Posted August 2, 2010 Posted August 2, 2010 You haven't set your variables. $km = $_POST[km]; $m = $_POST[m]; <html> <head> <title>tutorial</title> <meta http-equiv="Content-Type" content="text/html; charset=windows-1250"> </head> <body> <? $km = $_POST[km]; $m = $_POST[m]; if ($km > 0) $m = $km * 1000; ?> <form method=POST> //i try too method=GET and it failed too <table align="center" rules="none" cellpadding=5 bgcolor="#0563A5"> <tr><th colspan=2><font color="#FFFFFF">tutorial</font></th></tr> <tr><td><input type=text name=""km"" size=20 value="<? echo $km; ?>">km</td> <td> <input type=text name="m" size=20 value="<? echo $m; ?>"> m</td></tr> <tr><th colspan=2><input type=submit value="calc"></th></tr> </table> </form> </body> </html> Quote
vdo Posted August 2, 2010 Author Posted August 2, 2010 Thanks byron...now it is working correct. Quote
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.