Jump to content

benjamin_boothe

Members
  • Posts

    36
  • Joined

  • Last visited

    Never

Everything posted by benjamin_boothe

  1. This is the error I get now with adding - $result= mysql_query($link, $select) or die(mysql_error($link)); [quote]You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 4[/quote] I don't know where it is referring to.  Can somebody look at my code to see where the problem is. Look above in the post to see my code for the list page.
  2. This is the error that I get now: [quote]Warning: mysqli_error() expects exactly 1 parameter, 0 given in E:\Program Files\Apache Group\Apache2\htdocs\policylist.php on line 38[/quote] What does this mean I have to do?
  3. I'm trying to edit records from the web. I can display the list of records, but I can't display the lists of records to edit. I am trying to display the records with the use of an id. Basically, I trying to SELECT a record WHERE id=$id. Here is the code: [code] <!--set up the table --> <TABLE BORDER="1" CELLPADDING="5"> <TR>   <TH>Title</TH>   <TH>First name</TH>   <TH>Last name</TH>   <TH>Date of birth</TH>   <TH>UK residency</TH>   <TH>Marital status</TH>   <TH>Disability</TH>   <TH>Employment status</TH>   <TH>Address line 1</TH>   <TH>Area</TH>   <TH>Town</TH>   <TH>County</TH>   <TH>Post code</TH>   <TH>Telephone work</TH>   <TH>Telephone home</TH>   <TH>Fax number</TH>   <TH>Email</TH> </TR> <? $id = isSet($_POST['id']) ? $_POST['id'] : ''; include 'includes/db_conn.txt'; // build and execute the query     $select = "SELECT title, first_name, surname, date_of_birth, uk_residency,     marital_status, disability, employment_status, address_line_1, area, town,     county, post_code, telephone_work, telephone_home, fax_number, email FROM policy_holder     WHERE id=$id";     $result= mysqli_query($link, $select); while ($row = mysqli_fetch_array($result)) {   $t = $row['title'];   $fn = $row['first_name'];   $sn = $row['surname'];   $dob = $row['date_of_birth'];   $uk = $row['uk_residency'];   $ms = $row['marital_status'];   $d = $row['disability'];   $es = $row['employment_status'];   $ad1 = $row['address_line_1'];   $a = $row['area'];   $tn = $row['town'];   $c = $row['county'];   $pc = $row['post_code'];   $tw = $row['telephone_work'];   $th = $row['telephone_home'];   $fax = $row['fax_number'];   $em = $row['email'];   $id = $row['id'];   echo <<<END <TR>   <TD>$t</TD>   <TD>$fn</TD>   <TD>$sn</TD>   <TD>$dob</TD>   <TD>$uk</TD>   <TD>$ms</TD>   <TD>$d</TD>   <TD>$es</TD>   <TD>$ad1</TD>   <TD>$a</TD>   <TD>$tn</TD>   <TD>$c</TD>   <TD>$pc</TD>   <TD>$tw</TD>   <TD>$th</TD>   <TD>$fax</TD>   <TD>$em</TD>   <TD><a href="mysqli_list_update.php?id=$id">Edit details</a></TD> </TR> END; } ?> <!-- Close table --> </TABLE> [/code] I get this message when I trying to run it: [quote]Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in E:\Program Files\Apache Group\Apache2\htdocs\policylist.php on line 40 [/quote] Help me please!!!
  4. Hello Wildteen! Now it is just showing the headers and no fields to update. There is already data in the table for this form.
  5. Sorry, What I am changing on those lines?
  6. [quote] Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in E:\Program Files\Apache Group\Apache2\htdocs\edit_policy_holder.php on line 62 [/quote] This is the error msg I get when trying to create a web form that edits records in a database. This is my code: [code] <HTML> <HEAD> <STYLE> BODY {font-family:arial;} .error {font-weight:bold; color:#FF0000;} </STYLE> </HEAD> <BODY> <h2>Edit Policy Holder Details:</h2> <? // connect to the database include 'includes/db_conn.txt'; // has form been submitted? if ($_POST){   foreach($_POST as $k => $v){     $v = trim($v) ;     $$k = $v;   }     // build UPDATE query   $update = "UPDATE policy_holder SET     title='$t', first_name='$fn', surname='$sn', date_of_birth='$dob', uk_residency='$uk',     marital_status='$ms', disability='$d', employment_status='$es', address_line_1='$ad1',     area='$a', town='$tn', county='$c', post_code='$pc', telephone_work='$tw',     telephone_home='$th', fax_number='$fax', email='$em'     WHERE Id=$id";       // execute query and check for success   if (!mysqli_query($link, $update)){     $msg = "Error updating data - " .mysqli_error($link);   }else {   $msg = "Record successfully updated:";       // write table row confirming data       $table_row = <<<EOR       <TR>           <TD>$t</TD>           <TD>$fn</TD>           <TD>$sn</TD>           <TD>$dob</TD>           <TD>$uk</TD>           <TD>$ms</TD>           <TD>$d</TD>           <TD>$es</TD           <TD>$ad1</TD>           <TD>$a</TD>           <TD>$tn</TD>           <TD>$c</TD>           <TD>$pc</TD>           <TD>$tw</TD>           <TD>$th</TD>           <TD>$fax</TD>           <TD>$em</TD>       </TR>       EOR;     } // if not posted, check that an Id has been passed via the URL   } else {     if (!IsSet($_GET['id'])) {       $msg = "No policy owner selected!";     } else {       $id = $_GET['id'];       // build and execute the query       $select = "SELECT title, first_name, surname, date_of_birth, uk_residency,       marital_status, disability, employment_status, address_1_line, area, town, county,       post_code, telephone_work, telephone_home, fax_number, email FROM policy_holder       WHERE Id=$id";       $result = mysqli_query($link, $select);             // check that the record exists       if (mysqli_num_rows($result)<1) {         $msg = "No policy holder with that ID found!";       } else {       // set vars for form code       $form_start = "<FORM METHOD=\"post\"ACTION= \"" . $_SERVER['PHP_SELF']. "\">";       $form_end = <<<EOF       <TR>           <TD COLSPAN="2"><INPUT TYPE="submit" VALUE="Submit changes" /></TD>           <TD COLSPAN="2"><INPUT TYPE="reset" VALUE="Cancel" /></TD>       </TR>       </FORM>       EOF;       // assign the results to an array while ($row = mysqli_fetch_array($result)) {   $t = $row['title'];   $fn = $row['first_name'];   $sn = $row['surname'];   $dob = $row['date_of_birth'];   $uk = $row['uk_residency'];   $ms = $row['marital_status'];   $d = $row['disability'];   $es = $row['employment_status'];   $ad1 = $row['address_1_line'];   $a = $row['area'];   $tn = $row['town'];   $c = $row['county'];   $pc = $row['post_code'];   $tw = $row['telephone_work'];   $th = $row['telephone_home'];   $fax = $row['fax_number'];   $em = $row['email'];     // write table row with form fields   $table_row = <<<EOR <TR>     <TD><INPUT TYPE="text" NAME="title" VALUE="$t" SIZE="10"/></TD>     <TD><INPUT TYPE="text" NAME="first_name" VALUE="$fn" SIZE="10"/></TD>     <TD><INPUT TYPE="text" NAME="suranme" VALUE="$sn" SIZE="10"/></TD>     <TD><INPUT TYPE="text" NAME="date_of_birth" VALUE="$dob" SIZE="10"/></TD>     <TD><INPUT TYPE="text" NAME="uk_residency" VALUE="$uk" SIZE="10"/></TD>     <TD><INPUT TYPE="text" NAME="marital_status" VALUE="$ms" SIZE="10"/></TD>     <TD><INPUT TYPE="text" NAME="disability" VALUE="$d" SIZE="10"/></TD>     <TD><INPUT TYPE="text" NAME="employment_status" VALUE="$es" SIZE="10"/></TD>     <TD><INPUT TYPE="text" NAME="address_1_line" VALUE="$ad1" SIZE="25"/></TD>     <TD><INPUT TYPE="text" NAME="area" VALUE="$a" SIZE="10"/></TD>     <TD><INPUT TYPE="text" NAME="town" VALUE="$tn" SIZE="10"/></TD>     <TD><INPUT TYPE="text" NAME="county" VALUE="$c" SIZE="10"/></TD>     <TD><INPUT TYPE="text" NAME="post_code" VALUE="$pc" SIZE="10"/></TD>     <TD><INPUT TYPE="text" NAME="telephone_work" VALUE="$tw" SIZE="11"/></TD>     <TD><INPUT TYPE="text" NAME="telephone_home" VALUE="$th" SIZE="11"/></TD>     <TD><INPUT TYPE="text" NAME="fax_number" VALUE="$fax" SIZE="11"/></TD>     <TD><INPUT TYPE="text" NAME="email" VALUE="$em" SIZE="20"/></TD> </TR>   EOR; } // end 'if record exists' if       }       // end 'if ID given in URL' if       }       // end 'if form posted' if     }         // close connection     mysqli_close($link);         // print error/success message     echo (IsSet($msg)) ? "<div class=\"error\">$msg</div>" :"";     ?>     <TABLE BORDER="1" CELLPADDING="5">     <!-- Show start-of-form code if form needed -->     <? echo (IsSet($form_start)) ? $form_start :""; ?>         INPUT TYPE="HIDDEN" NAME="id" VALUE="<? echo $id ?>" />     <TR>       <TH>Title</TH>       <TH>First name</TH>       <TH>Last name</TH>       <TH>Date of birth</TH>       <TH>UK Residency</TH>       <TH>Marital Status</TH>       <TH>Disability</TH>       <TH>Employment Status</TH>       <TH>Address line 1</TH>       <TH>Area</TH>       <TH>Town</TH>       <TH>County</TH>       <TH>Post Code</TH>       <TH>Telephone work</TH>       <TH>Telephone home</TH>       <TH>Fax number</TH>       <TH>Email</TH>     </TR>     <!-- Show appropriate table row code (none set if there were errors) -->     <? echo (IsSet($table_row)) ? $table_row :""; ?>         <!-- Show end-of-form code if we are displaying the form -->     <? echo (IsSet($form_end)) ? $form_end :""; ?>     </TABLE>         <br/><a href="policylist.php">Back to policy holder list</a>     </BODY>     </HTML> [/code] Can anybody spot where I am going wrong?
  7. Because the globals are off I had to use this piece of code.  This was because at first, I was getting 'Notice: Undefined' messages.  So I had to declare all of my variables like this: [code] $t = isSet($_POST['title']) ? $_POST['title'] : ''; $fn = isSet($_POST['first_name']) ? $_POST['first_name'] : ''; $sn = isSet($_POST['surname']) ? $_POST['surname'] : ''; $dob = isSet($_POST['date_of_birth']) ? $_POST['date_of_birth'] : ''; $uk = isSet($_POST['uk_residency']) ? $_POST['uk_residency'] : ''; $ms = isSet($_POST['marital_status']) ? $_POST['marital_status'] : ''; $d = isSet($_POST['disability']) ? $_POST['disability'] : ''; $es = isSet($_POST['employment_status']) ? $_POST['employment_status'] : ''; $ad1 = isSet($_POST['address_line_1']) ? $_POST['address_line_1'] : ''; $a = isSet($_POST['area']) ? $_POST['area'] : ''; $tn = isSet($_POST['town']) ? $_POST['town'] : ''; $c = isSet($_POST['county']) ? $_POST['county'] : ''; $pc = isSet($_POST['post_code']) ? $_POST['post_code'] : ''; $tw = isSet($_POST['telephone_work']) ? $_POST['telephone_work'] : ''; $th = isSet($_POST['telephone_home']) ? $_POST['telephone_home'] : ''; $fax = isSet($_POST['fax_number']) ? $_POST['fax_number'] : ''; $em = isSet($_POST['email']) ? $_POST['email'] : ''; [/code] Beforehand I was declaring the variable like this: For example, if wanted to declare the 'fax_number' form variable, I was doing this: [code]$fax = isSet($_POST['fax']) ? $_POST['fax'] : '';[/code] Which was why it was not reading the values that I was inputting, as I was not making the field names (form inputs) equal to the variables like this: [code]$fax = isSet($_POST['fax_number']) ? $_POST['fax_number'] : '';[/code] That was the issue all along!!
  8. Thanks a lot HeyRay2. I've been stressing like a muthafucka over dat shit!! It was staring at me right in the face.  Lack of sleep!!! Dis PHP shit has become an addiction man!!! I can't thank you enough bro'
  9. [code] if ($msg=="") {     $insert = "INSERT INTO policy_holder     ( id, title, first_name, surname, date_of_birth, uk_residency, marital_status,     disability, employment_status, address_line_1, area, town, county, post_code,     telephone_work, telephone_home, fax_number, email)     VALUES ( NULL, '$t', '$fn', '$sn', '$dob', '$uk', '$ms', '$d', '$es', '$ad1', '$a',     '$tn', '$c', '$pc', '$tw', '$th', '$fax', '$em')"; [/code] That is the query I am running.  I echoed it to see what it is doing: [quote] INSERT INTO policy_holder ( id, title, first_name, surname, date_of_birth, uk_residency, marital_status, disability, employment_status, address_line_1, area, town, county, post_code, telephone_work, telephone_home, fax_number, email) VALUES ( NULL, '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '') [/quote] It's not returning the values in the db that I am putting into my form.
  10. The form successfully adds a record to the database. BUT.... it doesn't add what I put in the form, instead it adds 'NULL' to all of fields. So it looks like this: [img]http://localhost/policy_records.gif[/img] Is it beacuse the default value is NULL on all fields barring the id? If so, what can I do about that?
  11. Thankyou very much BUT... It does add records to the db but, all the entries have come up as NULL barring the date_of_birth field that prints today's date.  I want it to print the date that I put into the form.
  12. This is the error I am getting: [quote] Error inserting data - Incorrect date value: '' for column 'date_of_birth' at row 1 with query INSERT INTO policy_holder (id, title, first_name, surname, date_of_birth, uk_residency, marital_status, disability, employment_status, address_line_1, area, town, county, post_code, telephone_work, telephone_home, fax_number, email) VALUES ( NULL, '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '') [/quote] I have used NULL as my id (auto_increment) value as this worked when I inserted a record via SQL command line client. I have used DATE as my character type 'Foramt: YYYY-MM-DD', which I have used.  I cant see where the error is. Can somebody please help!!!  
  13. Here is the error message I get now with echoing the query in the error: [quote] Error inserting data - Incorrect date value: '' for column 'date_of_birth' at row 1 with query INSERT INTO policy_holder (id, title, first_name, surname, date_of_birth, uk_residency, marital_status, disability, employment_status, address_line_1, area, town, county, post_code, telephone_work, telephone_home, fax_number, email) VALUES (NULL, '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '') [/quote] I typed in NULL for my id auto_increment value because it worked when I entered a record via SQL command line client. Here are my table definitions, may be one day we'll get to the bottom of this: [img]http://localhost/policy_def.gif[/img]
  14. This is the query used: [quote]// if all data is there, build query   if ($msg=="") {     $insert = "INSERT INTO policy_holder     (id, title, first_name, surname, date_of_birth, uk_residency, marital_status,     disability, employment_status, address_line_1, area, town, county, post_code,     telephone_work, telephone_home, fax_number, email)     VALUES ('', '$t', '$fn', '$sn', '$dob', '$uk', '$ms', '$d', '$es', '$ad1', '$a',     '$tn', '$c', '$pc', '$tw', '$th', '$fax', '$em')";     // open db connection     include 'includes/db_conn.txt';     // execute query and check for success     if (!mysqli_query($link, $insert)) {       $msg = "Error inserting data - "  .mysqli_error($link);     } else {       $msg = "Record succesfully added";       // set vars to "" for next form input       $t = $fn = $sn = $dob = $uk = $ms = $d = $es = $ad1 = $a = $tn = $c = $pc = $tw = $th =       $fax = $em = "";     }     mysqli_close($link);   } [/quote] But it produces this error: [quote]Error inserting data - Out of range value adjusted for column 'id' at row 1[/quote] What can I do to get this form working correctly??
  15. Now I get this: [quote]Error inserting data - Column count doesn't match value count at row 1[/quote] I tried to add 'NULL' or '0' before instead of '' in VALUES but I get this message instead: [quote]Error inserting data - Column count doesn't match value count at row 1[/quote] Do I need to add a variable for 'id' in this part of the query statement: [quote]// set vars to "" for next form input       $t = $fn = $sn = $dob = $uk = $ms = $d = $es = $ad1 = $a = $tn = $c = $pc = $tw = $th = $fax = $em = "";[/quote] I'm very grateful for your time, I've spent hours and hours at the same point!!
  16. What VALUE can I use for my id column that is declared as auto_increment. As I still keep getting the same message.
  17. The id column is in auto_increment. What is meant by a query with a single blank space?
  18. No AndyB I am  using 1985-02-11 as my test data. This is what happens when I use echo $insert: [code] INSERT INTO policy_holder (id, title, first_name, surname, date_of_birth, uk_residency, marital_status, disability, employment_status, address_line_1, area, town, county, post_code, telephone_work, telephone_home, fax_number, email) VALUES ( NULL, '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '') Error inserting data - Incorrect date value: '' for column 'date_of_birth' at row 1 [/code]
  19. It's just one field that isn't printing into the database. What do you mean but echoing the query instead of running it? This is the query I am running: [code] if (!mysqli_query($link, $insert)) {       $msg = "Error inserting data - " .mysqli_error($link);     } else {       $msg = "Record succesfully added";       // set vars to "" for next form input       $t = $fn = $sn = $dob = $uk = $ms = $d = $es = $ad1 = $a = $tn = $c = $pc = $tw = $th =       $fax = $em = "";     }     mysqli_close($link);   } [/code]
  20. This is the msg I get when I try submit my form data to my db. My character type for this field is 'DATE'. YYYY-MM-DD is format for DATE and that I am typing in the form input field. HTML Code for this field is : [code]<TR>     <TD vAlign=top align=left>Date Of Birth </TD>     <TD vAlign=top align=left><INPUT TYPE="text" name="date_of_birth" VALUE="<? echo $dob ?>"/>     <BR></TD></TR>[/code] Where am I going wrong?
  21. Thanks Wildteen88 Incorrect date value: '' for column 'date_of_birth' at row 1 That is the error message I am getting now.  I have took this on board and typed it in the form in this format: YYYY-MM-DD.  That is the DATE format, which is the character type for this field. Because I have it as "text" as an input type on my form, does this make a difference?
  22. I need help!! My form is not submitting the data to db. I just keep getting msg 'Error inserting data' which was a comment in my if statment.  So it is working in that respect.  But I want to actually carry out the creating the record successfully. I can add a record manually but that's no good to me.  So there's got  be a problem with my form but I cannot see what!! Here is the code: <META content="MSHTML 6.00.2800.1458" name=GENERATOR></HEAD> <BODY bgColor=#99ccff> <DIV><B>GSI Insurance LTD</B> (Customer Contact Page)</DIV> <HR> <META http-equiv=Content-Type content="text/html; charset=iso-8859-1"> <? $t = isSet($_POST['t']) ? $_POST['t'] : ''; $fn = isSet($_POST['fn']) ? $_POST['fn'] : ''; $sn = isSet($_POST['sn']) ? $_POST['sn'] : ''; $dob = isSet($_POST['dob']) ? $_POST['dob'] : ''; $uk = isSet($_POST['uk']) ? $_POST['uk'] : ''; $ms = isSet($_POST['ms']) ? $_POST['ms'] : ''; $d = isSet($_POST['d']) ? $_POST['d'] : ''; $es = isSet($_POST['es']) ? $_POST['es'] : ''; $ad1 = isSet($_POST['ad1']) ? $_POST['ad1'] : ''; $a = isSet($_POST['a']) ? $_POST['a'] : ''; $tn = isSet($_POST['tn']) ? $_POST['tn'] : ''; $c = isSet($_POST['c']) ? $_POST['c'] : ''; $pc = isSet($_POST['pc']) ? $_POST['pc'] : ''; $tw = isSet($_POST['tw']) ? $_POST['tw'] : ''; $th = isSet($_POST['th']) ? $_POST['th'] : ''; $fax = isSet($_POST['fax']) ? $_POST['fax'] : ''; $em = isSet($_POST['em']) ? $_POST['em'] : ''; // has form been submitted? if ($_POST) {   // create empty error variable   $msg = "";     // put form data into variable variables   foreach($_POST as $k => $v) {     $v = trim($v) ;     $$k = $v ;           // check for data in both fields     if ($v=="") {       $msg = "Please fill in all fields";     }   }   // if all data is there, build query   if ($msg=="") {     $insert = "INSERT INTO policy_holder     (id, title, first_name, surname, date_of_birth, uk_residency, marital_status,     disability, employment_status, address_line_1, area, town, county, post_code,     telephone_work, telephone_home, fax_number, email)     VALUES ( NULL, '$t', '$fn', '$sn', '$dob', '$uk', '$ms', '$d', '$es', '$ad1', '$a',     '$tn', '$c', '$pc', '$tw', '$th', '$fax', '$em')";     // open db connection     include 'includes/db_conn.txt';     // execute query and check for success     if (!mysqli_query($link, $insert)) {       $msg = "Error inserting data";     } else {       $msg = "Record succesfully added";       // set vars to "" for next form input       $t = $fn = $sn = $dob = $uk = $ms = $d = $es = $ad1 = $a = $tn = $c = $pc = $tw = $th =       $fax = $em = "";     }     mysqli_close($link);   }   // print error or success messages   echo "<div class=\"error\">$msg</div>";   // if not submitted, create blank vars for form inputs } else {   $t = $fn = $sn = $dob = $uk = $ms = $d = $es = $ad1 = $a = $tn = $c = $pc = $tw = $th =   $fax = $em = ""; } ?> <FORM METHOD="post" ACTION="<? echo $_SERVER['PHP_SELF'] ?>"> <TABLE cellSpacing=0 cellPadding=5 border=0> <TR>     <TD vAlign=top align=left>Title </TD>     <TD vAlign=top align=left><SELECT size=1 name="title" VALUE="<? echo $t ?>"/> <OPTION         value="" selected>-- Please select --</OPTION> <OPTION         value=Mr>Mr</OPTION> <OPTION value=Mrs>Mrs</OPTION> <OPTION         value=Miss>Miss</OPTION> <OPTION value=MS>MS</OPTION></SELECT> <BR></TD></TR>   <TR>     <TD vAlign=top align=left>First Name </TD>     <TD vAlign=top align=left><INPUT TYPE="text" name="first_name" VALUE="<? echo $fn ?>"/>     <BR></TD></TR>   <TR>     <TD vAlign=top align=left>Last Name </TD>     <TD vAlign=top align=left><INPUT TYPE="text" name="surname" VALUE="<? echo $sn ?>"/>     <BR></TD></TR>   <TR>     <TD vAlign=top align=left>Date Of Birth </TD>     <TD vAlign=top align=left><INPUT TYPE="text" name="date_of_birth" VALUE="<? echo $dob ?>"/>     <BR></TD></TR>   <TR>     <TD vAlign=top align=left>UK Residency </TD>     <TD vAlign=top align=left><SELECT size=1 name="uk_residency" VALUE="<? echo $uk ?>"/> <OPTION         value="" selected>-- Please select --</OPTION> <OPTION         value="From Birth">From Birth</OPTION> <OPTION value="1 to 5 Years">1 to         5 Years</OPTION> <OPTION value="5 to 10 Years">5 to 10 Years</OPTION>         <OPTION value="10 or more Years">10 or more Years</OPTION></SELECT>   <BR></TD></TR>   <TR>     <TD vAlign=top align=left>Marital Status </TD>     <TD vAlign=top align=left><SELECT size=1 name="marital_status" VALUE="<? echo $ms ?>"/>     <OPTION value="" selected>-- Please select --</OPTION>     <OPTION value=Married>Married</OPTION>     <OPTION value=Single>Single</OPTION></SELECT> <BR></TD></TR>         <TR>     <TD vAlign=top align=left>Disability (or None) </TD>     <TD vAlign=top align=left><INPUT TYPE="text" name="disability" VALUE="<? echo $d ?>"/>     <BR></TD></TR>   <TR>     <TD vAlign=top align=left>Employment Status</TD>     <TD vAlign=top align=left><SELECT size=1 name="employment_status" VALUE="<? echo $es ?>"/>     <OPTION value="" selected>-- Please select --</OPTION>     <OPTION value=Self Employed>Self Employed</OPTION>     <OPTION value=Government>Government</OPTION>     <OPTION value=Other>Other</OPTION></SELECT> <BR></TD></TR>         <TR>     <TD vAlign=top align=left>Address Line 1 </TD>     <TD vAlign=top align=left><INPUT TYPE="text" name="address_line_1" VALUE="<? echo $ad1 ?>"/>     <BR></TD></TR>   <TR>     <TD vAlign=top align=left>Area </TD>     <TD vAlign=top align=left><INPUT TYPE="text" name="area" VALUE="<? echo $a ?>"/>     <BR></TD></TR>   <TR>     <TD vAlign=top align=left>Town </TD>     <TD vAlign=top align=left><INPUT TYPE="text" name="town" VALUE="<? echo $tn ?>"/>     <BR></TD></TR>   <TR>     <TD vAlign=top align=left>County </TD>     <TD vAlign=top align=left><INPUT TYPE="text" name="county" VALUE="<? echo $c ?>"/>     <BR></TD></TR>   <TR>     <TD vAlign=top align=left>Post Code </TD>     <TD vAlign=top align=left><INPUT TYPE="text" name="post_code" VALUE="<? echo $pc ?>"/>     <BR></TD></TR>   <TR>     <TD vAlign=top align=left>Telephone Work </TD>     <TD vAlign=top align=left><INPUT TYPE="text" name="telephone_work" VALUE="<? echo $tw ?>"/>     <BR></TD></TR>   <TR>     <TD vAlign=top align=left>Telephone Home </TD>     <TD vAlign=top align=left><INPUT TYPE="text" name="telephone_home" VALUE="<? echo $th ?>"/>     <BR></TD></TR>   <TR>     <TD vAlign=top align=left>Fax Number </TD>     <TD vAlign=top align=left><INPUT TYPE="text" name="fax_number" VALUE="<? echo $fax ?>"/>     <BR></TD></TR>   <TR>     <TD vAlign=top align=left>E-Mail </TD>     <TD vAlign=top align=left><INPUT TYPE="text" name="email" VALUE="<? echo $em ?>"/> <BR></TD></TR></TBODY></TABLE> <P><INPUT type=submit value="Add To Database" name=""> <INPUT type=reset value="Cancel"> </P></FORM> <HR>
  23. I keep getting 'Error inserting data' whenever I try to send data from my form to my db.  It has got to be a character type error on the db because I was able to add a record to the table manually.  So, it must be something to do with my HTML code.  I have used OPTION (SELECT SIZE) fields as well as TEXT (INPUT TYPE) fields. For the VALUE tag I am  putting in e.g. VALUE="<? echo $fn ?>"/>
  24. Thanks guys, But I have still have a problem whereby I cannot enter data into the db via my web form - It keeps stating that 'Error inserting data'.  I dont why this is.  I even was able to enter a record via command line SQL client. I have option boxes on my form, could this be why I keep getting the errors?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.