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>
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>
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now