Search the Community
Showing results for tags 'jqgrid'.
I am using jqforms to create simple forms and populate them from SQL data. This works fine when hard coded (eg search for ID with value x). However when I try to populate from $_GET values, it does not work, and I am going insane trying to understand why. First there is a simple PHP with my website menu (Main.php). Then it php-includes the php file (Form.php) containing my form. <?php include ("Form.php");?> This works and the forms work 100%. The URL accessed: www.website.com/Main.php?val=10254 In Form.php there is a simple SQL Select command. 'SELECT OrderID, ShipName FROM orders WHERE OrderID = '. $value .''; Above this, as a test, the $value is simply hardcoded. $value = 10254; This loads the database perfectly to the correct ID. It echoes this exact line (I realize echo will break the rest of the code, but just to test the output): SELECT OrderID, ShipName FROM orders WHERE OrderID = 10254 Okay. So everything is fine. Now here is the problem. Replace the hard-coded $value with: $value = $_GET['val']; It will echo this: SELECT OrderID, ShipName FROM orders WHERE OrderID = 10254 Which as you can see is the exact same thing as hard coded. And yet, remove the echo, and it will not load. What the hell is going on? I have lost 2 days so far because of this! It is literally echoing the same thing so why does it do nothing? My only guesses are how the value is being passed, and something to do with including the Form.php in the Main.php. The only reason I do that is that is how the jqform works (it for some reason does not work if you copy-paste the Form.php contents into Main.php... weird). Thank you for any help.