i using wamp mysql , php run local server. wamp server online , use simple html script run php file connects database , inserts data in table have created on wamp server.
the problem instead of running (executing) script, browser opens in text mode. in can see script.
now there have been similar questions on forum , others , people have solved problem. makes problem unique able run test.php. able display text open info.php php running on server, when use html form refuses run , opens script.
i using chrome browser , have checked in firefox same result.
i have 1 html file form linked php files handles connection , insertion of values in table on wamp server. name of database test.
form.html
<form action= "create_product.php" method= "get"> <center> <table> <td><label><b><font size="5"> name</label></td> <td><font size="5"><input type="text" name="name" /></td> </tr> <tr> <td><label><b><font size="5"> description</label></td> <td><font size="5"><input type="text" description="description" /></td> </tr> <tr> <center><td></td></center> <center><td><input type="submit" value="submit"/> <input type="reset" value="reset"/> </tr> </table> </center> insert_product.php
<?php $con= mysql_connect("localhost", "admin",""); $db = mysql_select_db("test"); $name = $_get["name"]; $description = $_get["description"]; $query = "insert products('name','description')values('".$name."','".$description."')"; $result = mysql_query($query); ?>
i had same problem , surfing known technical forums. figured out problem - nothing php or apache setup. nothing wrong code (at least on mine). here's not working: double-clicked open file finder (or explorer if windows user), , url in browser
"/file/xxxxx/foo.html"
. open
/file/xxxx/bar.php"
, doesn't work!
however, if typed url in browser
"localhost/~xxx/foo.html"
, runs nicely when
"bar.php"
is called.
perhaps can try.
"file:///xxxx/foo.php"
doesn't work,
"localhost/xxx/foo.php"
does.
Comments
Post a Comment