VinceGledhill Posted April 5, 2011 Share Posted April 5, 2011 hello People. I have been on a very steep learning curve and with great help from some people here I'm starting to get my stuff together. I am trying to get the info out of a form so that I can eventually process it as a form on my website. What I would like to know is what can I add, so that I can see what is going on? At the moment, I upload all the flies to a temp directory on my site. I load the form, fill it in and press the submit button. It then loads the process.php file but all I get is a blank screen, and nothing has been dumped in the database. So I know it's not working but I don't know how to debug it. Here is the code for my form. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Untitled Document</title> </head> <body> <form method ="post" action="process.php"> <p> </p> <table width="700" border="0" cellspacing="0" cellpadding="10"> <tr> <td bgcolor="#D6FFDC"> </td> <td align="right" valign="top" bgcolor="#D6FFDC"> </td> <td align="left" valign="middle" bgcolor="#D6FFDC"> </td> <td align="left" valign="top" bgcolor="#D6FFDC"> </td> <tr> <td width="100" bgcolor="#D6FFDC"> </td> <td width="200" align="right" valign="top" bgcolor="#D6FFDC"><div class="form_element_div"><strong>I.D.</strong> </td> <td width="200" align="left" valign="middle" bgcolor="#D6FFDC"><strong> <input name="id" type="int"> </strong></td> <td width="200" align="left" valign="top" bgcolor="#D6FFDC"><strong>Should this field be hidden?</strong></td> </tr> <tr> <td bgcolor="#D6FFDC"> </td> <td align="right" valign="top" bgcolor="#D6FFDC"><div class="form_element_div"><strong>Approved?</strong></td> <td align="left" valign="middle" bgcolor="#D6FFDC"><strong> <input type="varchar" name="approved" class='text_box'> </strong></td> <td align="left" valign="top" bgcolor="#D6FFDC"><strong>Should this be hidden?</strong></td> </tr> <tr> <td bgcolor="#D6FFDC"> </td> <td align="right" valign="top" bgcolor="#D6FFDC"><div class="form_element_div"><strong>Username</strong></td> <td align="left" valign="middle" bgcolor="#D6FFDC"><strong> <input type="varchar" name="name" class='text_box'> </strong></td> <td align="left" valign="top" bgcolor="#D6FFDC"><strong>Your Name</strong></td> </tr> <tr> <td bgcolor="#D6FFDC"> </td> <td align="right" valign="top" bgcolor="#D6FFDC"><div class="form_element_div"><strong>Airfield Name</strong></td> <td align="left" valign="middle" bgcolor="#D6FFDC"><strong> <input type="text" name="airfieldname" class='text_box'> </strong></td> <td align="left" valign="top" bgcolor="#D6FFDC"><strong>Known as</strong></td> </tr> <tr> <td bgcolor="#D6FFDC"> </td> <td align="right" valign="top" bgcolor="#D6FFDC"><div class="form_element_div"><strong>Height Above QNH</strong></td> <td align="left" valign="middle" bgcolor="#D6FFDC"><strong> <input type="int" name="heightabovesl" class='text_box'> </strong></td> <td align="left" valign="top" bgcolor="#D6FFDC"><strong>In Feet</strong></td> </tr> <tr> <td bgcolor="#D6FFDC"> </td> <td align="right" valign="top" bgcolor="#D6FFDC"><p><div class="form_element_div"><strong>General Location</strong></p> <p> </p></td> <td align="left" valign="middle" bgcolor="#D6FFDC"><strong> <input type="varchar" name="generallocation" rows=4 cols=25 class='text_area'></textarea> </strong></td> <td align="left" valign="top" bgcolor="#D6FFDC"><strong>I.E. 2nm North West of Newcastle</strong></td> </tr> <tr> <td bgcolor="#D6FFDC"> </td> <td align="right" valign="top" bgcolor="#D6FFDC"><div class="form_element_div"><strong>CoOrdinates</strong></td> <td align="left" valign="middle" bgcolor="#D6FFDC"><strong> <input type="varchar" name="co_ords" class='text_box'> </strong></td> <td align="left" valign="top" bgcolor="#D6FFDC"><strong>Degrees Minutes Seconds</strong></td> </tr> <tr> <td bgcolor="#D6FFDC"> </td> <td align="right" valign="top" bgcolor="#D6FFDC"><div class="form_element_div"><strong>PPR?</strong></td> <td align="left" valign="middle" bgcolor="#D6FFDC"><strong> <select name='priorpermission' class='text_select' > <option value="yes" >yes</option> <option value="no" >no</option> </select> </strong></td> <td align="left" valign="top" bgcolor="#D6FFDC"><strong>Yes / No</strong></td> </tr> <tr> <td bgcolor="#D6FFDC"> </td> <td align="right" valign="top" bgcolor="#D6FFDC"><div class="form_element_div"><strong>Alternative Airfield</strong></td> <td align="left" valign="middle" bgcolor="#D6FFDC"><strong> <input type="text" name="alternatefield" class='text_box'> </strong></td> <td align="left" valign="top" bgcolor="#D6FFDC"><strong>Alternative for Microlights</strong></td> </tr> <tr> <td bgcolor="#D6FFDC"> </td> <td align="right" valign="top" bgcolor="#D6FFDC"><div class="form_element_div"><strong>Air Ground Radio</strong></td> <td align="left" valign="middle" bgcolor="#D6FFDC"><strong> <select name='airground' class='text_select'width = 20pt> <option value="Yes" >Yes</option> <option value="No" >No</option> </select> </strong></td> <td align="left" valign="top" bgcolor="#D6FFDC"><strong>Yes / No</strong></td> </tr> <tr> <td bgcolor="#D6FFDC"> </td> <td align="right" valign="top" bgcolor="#D6FFDC"><div class="form_element_div"><strong>Radio Frequency</strong></td> <td align="left" valign="middle" bgcolor="#D6FFDC"><strong> <input type="text" name="radiofrequency" class='text_box'> </strong></td> <td align="left" valign="top" bgcolor="#D6FFDC"><strong>A/G or Safetycom</strong></td> </tr> <tr> <td bgcolor="#D6FFDC"> </td> <td align="right" valign="top" bgcolor="#D6FFDC"><div class="form_element_div"><strong>Runways & Length</strong></td> <td align="left" valign="middle" bgcolor="#D6FFDC"><strong> <textarea name="runways" rows=4 cols=25 class='text_area'></textarea> </strong></td> <td align="left" valign="top" bgcolor="#D6FFDC"><p><strong>E.G. <br /> 06-24 - 560m<br /> 18-36 - 400m<br /> </strong></p></td> </tr> <tr> <td bgcolor="#D6FFDC"> </td> <td align="right" valign="top" bgcolor="#D6FFDC"><div class="form_element_div"><strong>Runway Surface</strong></td> <td align="left" valign="middle" bgcolor="#D6FFDC"><strong> <input type="text" name="surface" class='text_box'> </strong></td> <td align="left" valign="top" bgcolor="#D6FFDC"><strong>E.G. Grass / Tarmac </strong></td> </tr> <tr> <td bgcolor="#D6FFDC"> </td> <td align="right" valign="top" bgcolor="#D6FFDC"><div class="form_element_div"><strong>Circuits</strong></td> <td align="left" valign="middle" bgcolor="#D6FFDC"><strong> <textarea name="circuits" rows=4 cols=25 class='text_area'></textarea> </strong></td> <td align="left" valign="top" bgcolor="#D6FFDC"><strong>E.G. <br /> 06-LH<br /> 24-RH <br /> </strong></td> </tr> <tr> <td bgcolor="#D6FFDC"> </td> <td align="right" valign="top" bgcolor="#D6FFDC"><div class="form_element_div"><strong>Remarks</strong></td> <td align="left" valign="middle" bgcolor="#D6FFDC"><strong> <textarea name="remarks" rows=4 cols=25 class='text_area'></textarea> </strong></td> <td align="left" valign="top" bgcolor="#D6FFDC"><strong>E.G. Airfield under 28 day rule etc.</strong></td> </tr> <tr> <td bgcolor="#D6FFDC"> </td> <td align="right" valign="top" bgcolor="#D6FFDC"><div class="form_element_div"><strong>Warnings</strong></td> <td align="left" valign="middle" bgcolor="#D6FFDC"><strong> <textarea name="warnings" rows=4 cols=25 class='text_area'></textarea> </strong></td> <td align="left" valign="top" bgcolor="#D6FFDC"><strong>E.G. Don't fly over local vilages etc.</strong></td> </tr> <tr> <td bgcolor="#D6FFDC"> </td> <td align="right" valign="top" bgcolor="#D6FFDC"><div class="form_element_div"><strong>Operating Hrs</strong></td> <td align="left" valign="middle" bgcolor="#D6FFDC"><strong> <input type="text" name="ophours" value="" class='text_box'> </strong></td> <td align="left" valign="top" bgcolor="#D6FFDC"><strong>SR-SS or time.</strong></td> </tr> <tr> <td bgcolor="#D6FFDC"> </td> <td align="right" valign="top" bgcolor="#D6FFDC"><div class="form_element_div"><strong>Contacts</strong></td> <td align="left" valign="middle" bgcolor="#D6FFDC"><strong> <textarea name="contactdetails" rows=4 cols=25 class='text_area'></textarea> </strong></td> <td align="left" valign="top" bgcolor="#D6FFDC"><strong>Contacts with as much info as possible, including web address if possible.</strong></td> </tr> <tr> <td bgcolor="#D6FFDC"> </td> <td align="right" valign="top" bgcolor="#D6FFDC"><div class="form_element_div"><strong>Landing Fee</strong></td> <td align="left" valign="middle" bgcolor="#D6FFDC"><strong> <input type="text" name="landingfee" class='text_box'> </strong></td> <td align="left" valign="top" bgcolor="#D6FFDC"><div class="form_element_div"><strong>£ for Microlights</strong></td> </tr> <tr> <td bgcolor="#D6FFDC"> </td> <td align="right" valign="top" bgcolor="#D6FFDC"><div class="form_element_div"><strong>Google Iframe Code</strong></td> <td align="left" valign="middle" bgcolor="#D6FFDC"><strong> <textarea name="google_iframe" rows=4 cols=25 class='text_area'></textarea> </strong></td> <td align="left" valign="top" bgcolor="#D6FFDC"><strong>700px X 700px Google Iframe Code</strong></td> </tr> <tr> <td bgcolor="#D6FFDC"> </td> <td align="right" valign="top" bgcolor="#D6FFDC"><input type="submit" value="Submit"> </td> <td align="left" valign="middle" bgcolor="#D6FFDC"> </td> <td align="left" valign="top" bgcolor="#D6FFDC"> </td> </tr> </table> </body> </html> And here is the code from the process.php file that the above refers to... <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Untitled Document</title> </head> <body> <?php require ("connect.php"); $id = $_POST['id']; //$status = $_POST['status']; $name = $_POST['name']; $airfieldname = $_POST['airfieldname']; $heightabovesl = $_POST['heightabovesl']; $generallocation = $_POST['generallocation']; $co_ords = $_POST['co_ords']; $priorpermission = $_POST['priorpermission']; $alternatefield = $_POST['alternatefield']; $airground = $_POST['airground']; $radiofrequency= $_POST['radiofrequency']; $runways = $_POST['runways']; $surface = $_POST['surface']; $circuits = $_POST['circuits']; $remarks = $_POST['remarks']; $warnings = $_POST['warnings']; $ophours = $_POST['ophours']; $contactdetails = $_POST['contactdetails']; $landingfee = $_POST['landingfee']; $google_iframe = $_POST['google_iframe']; $approved = $_POST['approved']; $sql=mysql_query("INSERT INTO user_input(id,name,airfieldname, heightabovesl,generallocation, co_ords,priorpermission,alternatefield,airground,radiofrequency,runways,surface,circuits,remarks,warnings,ophours, contactdetails, landingfee,google_iframe,approved) VALUES ('".$_POST['id']."','".$_POST['name']."','".$_POST['airfieldname']."','".$_POST['heightabovesl']."','".$_POST['generallocation']."','".$_POST['co_ords']."','".$_POST['priorpermission']."','".$_POST['alternatefield']."','".$_POST['airground']."','".$_POST['radiofrequency']."','".$_POST['runways']."','".$_POST['surface']."','".$_POST['circuits']."','".$_POST['remarks']."','".$_POST['warnings']."','".$_POST['ophours']."',".$_POST['contactdetails'].",'".$_POST['landingfee']."','".$_POST['google_iframe']."','".$_POST['approved']."'); ?> </body> </html> And here is the code from the connect.php <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Untitled Document</title> </head> <body> <?php $connect = mysql_connect("localhost","my_DB_name","my_password") or die ("mysql_error"); mysql_select_db("airfield_data") or die(mysql_error()); echo "connected!"; ?> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/232784-how-do-i-monitor-what-is-going-on/ Share on other sites More sharing options...
kanikilu Posted April 5, 2011 Share Posted April 5, 2011 I don't know if it matters, but you don't need the doctype, head and other HTML markup in your connect.php or process.php files. I see you have it trying to echo "connected!" in your connect.php file. Does that even show up? If not, I think maybe there is a configuration problem on the server. Are you sure PHP is even working correctly? If not, try a very simple example. Create a new file called phpinfo.php and put the following in there: <?php phpinfo(); ?> Save and upload it, then browse to that file on your server. Quote Link to comment https://forums.phpfreaks.com/topic/232784-how-do-i-monitor-what-is-going-on/#findComment-1197431 Share on other sites More sharing options...
SamT_ Posted April 5, 2011 Share Posted April 5, 2011 Change your connect.php to this: <?php $connect = mysql_connect("localhost","my_DB_name","my_password") or die ("mysql_error"); mysql_select_db("airfield_data") or die(mysql_error()); You do not need any HTML here because this is not the script that is outputting anything. include(), require(), include_once(), require_once() does nothing more than copy-paste the code from the included/required file into the file where the include or require was called. By calling the connect.php now, you're producing invalid HTML. When you're not outputing anything (i.e. creating a PHP for inclusion ONLY), you can omit your ending php tag ( ?> ). Once you start getting into headers (like cookies), this will save you a lot of headache later on. While this is probably not the problem (in terms of a white page), it will help you down the road when you see HTML and wondering why you have excess HTML. In process.php, before <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> Add the following: <?php error_reporting(E_ALL); ?> Give us the error that comes up. Quote Link to comment https://forums.phpfreaks.com/topic/232784-how-do-i-monitor-what-is-going-on/#findComment-1197437 Share on other sites More sharing options...
VinceGledhill Posted April 6, 2011 Author Share Posted April 6, 2011 Thanks for your help guys. I will take a look when I get home at the weekend, I'm away on business at the moment. Can't wait now! It was driving me nuts. This forum and the help I've received so far with my coding has been awesome, thanks! Quote Link to comment https://forums.phpfreaks.com/topic/232784-how-do-i-monitor-what-is-going-on/#findComment-1197931 Share on other sites More sharing options...
spiderwell Posted April 6, 2011 Share Posted April 6, 2011 Also there's no closing tag on the </form>. or i couldnt see one, not sure if that would affect anything Quote Link to comment https://forums.phpfreaks.com/topic/232784-how-do-i-monitor-what-is-going-on/#findComment-1197946 Share on other sites More sharing options...
VinceGledhill Posted April 11, 2011 Author Share Posted April 11, 2011 Change your connect.php to this: <?php $connect = mysql_connect("localhost","my_DB_name","my_password") or die ("mysql_error"); mysql_select_db("airfield_data") or die(mysql_error()); You do not need any HTML here because this is not the script that is outputting anything. include(), require(), include_once(), require_once() does nothing more than copy-paste the code from the included/required file into the file where the include or require was called. By calling the connect.php now, you're producing invalid HTML. When you're not outputing anything (i.e. creating a PHP for inclusion ONLY), you can omit your ending php tag ( ?> ). Once you start getting into headers (like cookies), this will save you a lot of headache later on. While this is probably not the problem (in terms of a white page), it will help you down the road when you see HTML and wondering why you have excess HTML. In process.php, before <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> Add the following: <?php error_reporting(E_ALL); ?> Give us the error that comes up. Hi Sam. Thanks for the input, I've done that and I still get the same problem, blank screen. Quote Link to comment https://forums.phpfreaks.com/topic/232784-how-do-i-monitor-what-is-going-on/#findComment-1200101 Share on other sites More sharing options...
AbraCadaver Posted April 11, 2011 Share Posted April 11, 2011 At a minimum you're missing a double quote at the end of your $sql definition. Look at how the syntax highlighting changes after that line. To answer your question, use this while testing: error_reporting(E_ALL); ini_set('display_errors', '1'); You may have to change these in php.ini in order to see parse errors. Quote Link to comment https://forums.phpfreaks.com/topic/232784-how-do-i-monitor-what-is-going-on/#findComment-1200151 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.