mndasari Posted March 23, 2009 Share Posted March 23, 2009 Hi, I am new to php & have a question about form's action func. My html file contains a form, having method="post" and action="filename.php". This filename.php is in the same dir as of html. I show html page in browser, hit submit button, it executes php script and shows output. But the problem is, now, if I modify php file e.g. add an echo statement, new changes donot get executed at all, same old output is still shown in the browser. Instead, if I run this php script at command line, it works fine. Could you please help! Thanks. Link to comment https://forums.phpfreaks.com/topic/150674-problem-with-form-action-php-function/ Share on other sites More sharing options...
RichardRotterdam Posted March 23, 2009 Share Posted March 23, 2009 Put your php code between the [ code ] tags and people can see what might be the problem. It's difficult to see what it is that is causing the problem without the script Link to comment https://forums.phpfreaks.com/topic/150674-problem-with-form-action-php-function/#findComment-791570 Share on other sites More sharing options...
mndasari Posted March 23, 2009 Author Share Posted March 23, 2009 Code is here ... File: new_form.html <html> <body> <form method="post" action="new_scr.php"> Enter user id: <input type=text name=user_id> <input type=submit value="Submit"> </form> </body> </html> File: new_scr.php <?php $username="xxx"; $password="yyy"; $database="zzz"; mysql_connect(localhost,$username,$password); @mysql_select_db($database) or die( "Unable to select database"); $user_id = $_POST['user_id']; $qry = "SELECT * FROM user_tbl where user_id = '" . $user_id . "'"; $result = mysql_query( $qry ) or die(mysql_error()); $row = mysql_fetch_array($result); $user_name = $row['last_name'] . ", " . $row['first_name']; echo "User name: " . $user_name; echo "Script ended."; ?> Here, new_scr.php is printing user name correctly. Later I added line in red color to php file, I reloaded the form in the same browser window (same session) and hit submit button but new echo statement is not printed- somehow its executing the original .php file again (new changes are not effective). I tried clearing browser cache but didnot work. Any suggestions would greatly help! Link to comment https://forums.phpfreaks.com/topic/150674-problem-with-form-action-php-function/#findComment-791583 Share on other sites More sharing options...
shadiadiph Posted March 23, 2009 Share Posted March 23, 2009 oops sorry didn't see that there. try $qry = "SELECT * FROM user_tbl where user_id =$user_id"; or if its just the last line you changed try just using print "Script Ended."; Link to comment https://forums.phpfreaks.com/topic/150674-problem-with-form-action-php-function/#findComment-791615 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.