norm101 Posted January 24, 2009 Share Posted January 24, 2009 Hi All - I created a Hello World project consisting of a form and a PHP page that is called when a Submit button is pressed. I've tried debugging this with Eclipse/Zend debugger and phpDesigner. With both tools, when Submit is pressed, my breakpoint in the 2nd form does not get triggered. Instead, the debugger just displays the name of the PHP file. So, how can I debug a simple scenario like this? Thanks, Norm Link to comment https://forums.phpfreaks.com/topic/142223-how-to-debug-a-form/ Share on other sites More sharing options...
9three Posted January 24, 2009 Share Posted January 24, 2009 Can you post your code please. Link to comment https://forums.phpfreaks.com/topic/142223-how-to-debug-a-form/#findComment-745100 Share on other sites More sharing options...
uniflare Posted January 24, 2009 Share Posted January 24, 2009 I've recently come across compilers for PHP where you can make portable cross-platform independant exectuable applications (phew..), or simply put: .exe files. One i tried recently (did not compile properly for me) which had a nice working debugging step/trace tool was Roadsend IDE. Hope this helps. EDIT: I see you want a debugger where you can go through it like a website whilst looking at the call stack etc. You may need to manually pass arguments to the script. Link to comment https://forums.phpfreaks.com/topic/142223-how-to-debug-a-form/#findComment-745107 Share on other sites More sharing options...
norm101 Posted January 24, 2009 Author Share Posted January 24, 2009 Form.php <html> <body> <form action="registration_action.php" method="post"> Name: <input type="text" name="name" /> Age: <input type="text" name="age" /> <input type="submit" /> </form> </body> </html ------------------------------------- registration_action.php <html> <body> Welcome <?php echo $_POST["name"]; ?>.<br /> You are <?php echo $_POST["age"]; ?> years old. </body> </html> Link to comment https://forums.phpfreaks.com/topic/142223-how-to-debug-a-form/#findComment-745115 Share on other sites More sharing options...
9three Posted January 24, 2009 Share Posted January 24, 2009 change your php file to <?php $user = $_POST['name']; $age = $_POST['age']; ?> <html> <body> Welcome <?php echo $user; ?>. <br /> You are <?php echo $age; ?> years old. </body> </html> Link to comment https://forums.phpfreaks.com/topic/142223-how-to-debug-a-form/#findComment-745122 Share on other sites More sharing options...
norm101 Posted January 24, 2009 Author Share Posted January 24, 2009 Thanks - I tried that but it produces the same result. Link to comment https://forums.phpfreaks.com/topic/142223-how-to-debug-a-form/#findComment-745262 Share on other sites More sharing options...
NorthWestSimulations Posted January 24, 2009 Share Posted January 24, 2009 <?php session_start(); ?> <html> <body> <form action="registration_action.php" method="post" name="lalal"> Name: <input type="text" name="name"> Age: <input type="text" name="age"> <input type="submit"> </form> </body> </html registration_action.php <?php session_start(); $_SESSION['name'] = $_POST["name"]; $_SESSION['age'] = $_POST["age"]; $name = $_SESSION['name']; $age = $_SESSION['age']; ?> <html> <body> Welcome <?php echo $name; ?>.<br /> You are <?php echo $age; ?> years old. <?php session_destroy(); ?> </body> </html> Link to comment https://forums.phpfreaks.com/topic/142223-how-to-debug-a-form/#findComment-745273 Share on other sites More sharing options...
uniflare Posted January 24, 2009 Share Posted January 24, 2009 hmm, your original script should work flawlessly. try putting: <?php print_r($_REQUEST); ?> On the registration_page.php anywhere. it will echo the contents of any custom data (like form data) sent to the server from the browser. (like POST or GET data). if its empty try setting the form method to GET and see if that helps. (GET is sent via the URL, POST is sent underneath i believe in some headers sent to the server (along with the browser version etc etc). Link to comment https://forums.phpfreaks.com/topic/142223-how-to-debug-a-form/#findComment-745413 Share on other sites More sharing options...
norm101 Posted January 25, 2009 Author Share Posted January 25, 2009 Thanks to all that responded. Yes, the code does work flawlessly. I'm trying to set up my debug environment and I don't understand why the debugger doesn't hit my breakpoint in the second file? When I click the submit button, the only output from the debugger is the name of the second file??? Can anyone recommend a debugger that will enable me to step-through a simple scenario like this? Norm Link to comment https://forums.phpfreaks.com/topic/142223-how-to-debug-a-form/#findComment-745702 Share on other sites More sharing options...
uniflare Posted January 25, 2009 Share Posted January 25, 2009 That's what i thought originally lol. To php Freaks: There is nothing wrong with this mans code, he needs advice on debugging tools available to php programmers. Read his post just above this 1 for details. lol. Link to comment https://forums.phpfreaks.com/topic/142223-how-to-debug-a-form/#findComment-745705 Share on other sites More sharing options...
redarrow Posted January 25, 2009 Share Posted January 25, 2009 try this way mate. one whole page.php <html> <body> <?php if(isset($_POST['submit'])){ echo "Welcome {$_POST["name"]} <br /> You are {$_POST["age"]} years old."; }?> <form action="registration_action.php" method="post"> Name: <input type="text" name="name" /> Age: <input type="text" name="age" /> <input type="submit" name="submit" value="SEND!"/> </form> </body> </html> Link to comment https://forums.phpfreaks.com/topic/142223-how-to-debug-a-form/#findComment-745706 Share on other sites More sharing options...
redarrow Posted January 25, 2009 Share Posted January 25, 2009 sorry i use zend products only. try notepad++ suppose to be good or php designer Link to comment https://forums.phpfreaks.com/topic/142223-how-to-debug-a-form/#findComment-745708 Share on other sites More sharing options...
norm101 Posted January 25, 2009 Author Share Posted January 25, 2009 YES, yes!! I've tried both Eclipse/Zend and phpDesigner with the same result, so I'm thinking it isn't a tool problem but something else I'm missing. I'm new to PHP programming, but I think this has got to be a pretty common debugging scenario and it should be straightforward to debug via stepping through code. Norm Link to comment https://forums.phpfreaks.com/topic/142223-how-to-debug-a-form/#findComment-745709 Share on other sites More sharing options...
redarrow Posted January 25, 2009 Share Posted January 25, 2009 Ok i get you now, zend and other php programs need to be configured to use your current test server to use the debugging screen properly. i dont use the debugung screen to test my submitted results i save the file then use a proper url to the page. you need to read the zend manual to setup the server part off the zend program or other programs m8. that what you mean.... i also get the url in the debug page pressing the button, but that becouse i haven set my zend to point to my proper testing server. Link to comment https://forums.phpfreaks.com/topic/142223-how-to-debug-a-form/#findComment-745710 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.