Solved

date not inserting in mysql

Posted on 2007-12-06
17
181 Views
Last Modified: 2013-12-12
I am using this to get the date in my form

<td><center><font color="red"><b><?php echo date("m-d-Y"); ?></b></font><input name="submitdate" type="hidden" value="<?php date(); ?>" /></td>

however when I check mysql Database for submitdate field it shows 0000-00-00 and I don't see the date. The submitdate field type is date
Thanks
0
Comment
Question by:syedasimmeesaq
  • 7
  • 6
  • 3
  • +1
17 Comments
 
LVL 20

Assisted Solution

by:steelseth12
steelseth12 earned 300 total points
ID: 20422312
<strong><td><center><font color="red"><b><?php echo date("m-d-Y"); ?></b></font><input name="submitdate" type="hidden" value="<?php echo date("m-d-Y"); ?>" /></td></strong>
0
 
LVL 142

Assisted Solution

by:Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3] earned 100 total points
ID: 20422318
for MySQL, the date format for insert needs to be YYYY-MM-DD ...
0
 
LVL 20

Expert Comment

by:steelseth12
ID: 20422320
The date function needs at least 1 parameter ... the date format

also you forgot to echo the date
0
 
LVL 9

Author Comment

by:syedasimmeesaq
ID: 20422339
tried both. Still doesn't work
0
 
LVL 20

Expert Comment

by:steelseth12
ID: 20422340
Also we do you dont you use the mysql CURRENT_DATE instead of sending the value from php ?

0
 
LVL 20

Expert Comment

by:steelseth12
ID: 20422376
I think if you combine both suggestion it will work ...

<strong><td><center><font color="red"><b><?php echo date("m-d-Y"); ?></b></font><input name="submitdate" type="hidden" value="<?php echo date("Y-m-d"); ?>" /></td></strong>

but it would be better to do

your_date_field = CURRENT_DATE in your SQL statement
0
 

Expert Comment

by:danielatmyra
ID: 20422385
What is your SQL command? If you insert the date field as NULL it will just use the current date.
0
 
LVL 9

Author Comment

by:syedasimmeesaq
ID: 20422500
It also doesn't insert the session information either. Please find the code below
Thanks
<?php

session_start();
 

if ($_SESSION['CFuser'] && $_SESSION['CFpass']) {//1
 

require_once('con_info.php');

if(isset($_POST["submit"]))

{//2
 

$reigonid = mysql_real_escape_string($_POST['reigonid']);

$devlschool = mysql_real_escape_string($_POST['devls']);

$cln = mysql_real_escape_string($_POST['cln']);

$cfn = mysql_real_escape_string($_POST['cfn']);

$cdb_m = mysql_real_escape_string($_POST['cdb_m']);

$cdb_d = mysql_real_escape_string($_POST['cdb_d']);

$cdb_y = mysql_real_escape_string($_POST['cdb_y']);

$tosc = mysql_real_escape_string($_POST['tosc']);

$osf = mysql_real_escape_string($_POST['osf']);

$fl9_1 = mysql_real_escape_string($_POST['fl9_1']);

$tr9_1 = mysql_real_escape_string($_POST['tr9_1']);

$fl9_2 = mysql_real_escape_string($_POST['fl9_2']);

$tr9_2 = mysql_real_escape_string($_POST['tr9_2']);

$fl9_3 = mysql_real_escape_string($_POST['fl9_3']);

$tr9_3 = mysql_real_escape_string($_POST['tr9_3']);

$fl9_4 = mysql_real_escape_string($_POST['fl9_4']);

$tr9_4 = mysql_real_escape_string($_POST['tr9_4']);

$fl9_5 = mysql_real_escape_string($_POST['fl9_5']);

$tr9_5 = mysql_real_escape_string($_POST['tr9_5']);

$ing_10 = mysql_real_escape_string($_POST['ing_10']);

$ing_10_other = mysql_real_escape_string($_POST['ing_10_other']);

$q11 = mysql_real_escape_string($_POST['q11']);

$PSES_asses_date = mysql_real_escape_string($_POST['PSES_asses_date']);

$PSES_asses_name2 = mysql_real_escape_string($_POST['PSES_asses_name2']);

$PSES_asses_tr_1 = mysql_real_escape_string($_POST['PSES_asses_tr_1']);

$PSES_asses_lp_1 = mysql_real_escape_string($_POST['PSES_asses_lp_1']);

$PSES_sk_one = mysql_real_escape_string($_POST['PSES_sk_one']);

$PSES_asses_tr_2  = mysql_real_escape_string($_POST['PSES_asses_tr_2 ']);

$PSES_asses_lp_2 = mysql_real_escape_string($_POST['PSES_asses_lp_2']);

$PSES_sk_two = mysql_real_escape_string($_POST['PSES_sk_two']);

$PSES_2OD_source_parent_a = mysql_real_escape_string($_POST['PSES_2OD_source_parent_a']);

$PSES_2od_lp_1 = mysql_real_escape_string($_POST['PSES_2od_lp_1']);

$PSES_2od_sk_1 = mysql_real_escape_string($_POST['PSES_2od_sk_1']);

$PSES_2OD_source_parent_b = mysql_real_escape_string($_POST['PSES_2OD_source_parent_b']);

$PSES_2od_lp_2 = mysql_real_escape_string($_POST['PSES_2od_lp_2']);

$PSES_2od_sk_2 = mysql_real_escape_string($_POST['PSES_2od_sk_2']);

$PSES_2od_c = mysql_real_escape_string($_POST['PSES_2od_c']);

$PSES_2od_lp_3 = mysql_real_escape_string($_POST['PSES_2od_lp_3']);

$PSES_2od_sk_3 = mysql_real_escape_string($_POST['PSES_2od_sk_3']);

$PSES_2od_d = mysql_real_escape_string($_POST['PSES_2od_d']);

$PSES_2od_lp_4 = mysql_real_escape_string($_POST['PSES_2od_lp_4']);

$PSES_2od_sk_4 = mysql_real_escape_string($_POST['PSES_2od_sk_4']);

$PSES_3 = mysql_real_escape_string($_POST['PSES_3']);

$PSES_4 = mysql_real_escape_string($_POST['PSES_4']);

$PSES_B = mysql_real_escape_string($_POST['PSES_B']);

$ASK_asses_date = mysql_real_escape_string($_POST['ASK_asses_date']);

$AKS_asses_name = mysql_real_escape_string($_POST['AKS_asses_name']);

$ASK_asses_tr_1 = mysql_real_escape_string($_POST['ASK_asses_tr_1']);

$ASK_asses_lp_1 = mysql_real_escape_string($_POST['ASK_asses_lp_1']);

$ASK_sk_one = mysql_real_escape_string($_POST['ASK_sk_one']);

$ASK_asses_tr_2 = mysql_real_escape_string($_POST['ASK_asses_tr_2']);

$ASK_asses_lp_2 = mysql_real_escape_string($_POST['ASK_asses_lp_2']);

$ASK_sk_two = mysql_real_escape_string($_POST['ASK_sk_two']);

$ASK_2od_c = mysql_real_escape_string($_POST['ASK_2od_c']);

$ASK_2OD_source_parent_a = mysql_real_escape_string($_POST['ASK_2OD_source_parent_a']);

$ASK_2od_lp_1 = mysql_real_escape_string($_POST['ASK_2od_lp_1']);

$ASK_2od_sk_1 = mysql_real_escape_string($_POST['ASK_2od_sk_1']);

$ASK_2OD_source_parent_b = mysql_real_escape_string($_POST['ASK_2OD_source_parent_b']);

$ASK_2od_lp_2 = mysql_real_escape_string($_POST['ASK_2od_lp_2']);

$ASK_2od_sk_2 = mysql_real_escape_string($_POST['ASK_2od_sk_2']);

$ASK_2od_lp_3 = mysql_real_escape_string($_POST['ASK_2od_lp_3']);

$ASK_2od_sk_3 = mysql_real_escape_string($_POST['ASK_2od_sk_3']);

$ASK_2od_d = mysql_real_escape_string($_POST['ASK_2od_d']);

$ASK_2od_lp_4 = mysql_real_escape_string($_POST['ASK_2od_lp_4']);

$ASK_2od_sk_4 = mysql_real_escape_string($_POST['ASK_2od_sk_4']);

$ASK_3 = mysql_real_escape_string($_POST['ASK_3']);

$ASK_4 = mysql_real_escape_string($_POST['ASK_4']);

$ASK_B = mysql_real_escape_string($_POST['ASK_B']);

$TAA_asses_date = mysql_real_escape_string($_POST['TAA_asses_date']);

$TAA_asses_name = mysql_real_escape_string($_POST['TAA_asses_name']);

$TAA_asses_tr_1 = mysql_real_escape_string($_POST['TAA_asses_tr_1']);

$TAA_asses_lp_1 = mysql_real_escape_string($_POST['TAA_asses_lp_1']);

$TAA_sk_one = mysql_real_escape_string($_POST['TAA_sk_one']);

$TAA_asses_tr_2 = mysql_real_escape_string($_POST['TAA_asses_tr_2']);

$TAA_asses_lp_2 = mysql_real_escape_string($_POST['TAA_asses_lp_2']);

$TAA_sk_two = mysql_real_escape_string($_POST['TAA_sk_two']);

$TAA_2od_c = mysql_real_escape_string($_POST['TAA_2od_c']);

$TAA_2OD_source_parent_a = mysql_real_escape_string($_POST['TAA_2OD_source_parent_a']);

$TAA_2od_lp_1 = mysql_real_escape_string($_POST['TAA_2od_lp_1']);

$TAA_2od_sk_1 = mysql_real_escape_string($_POST['TAA_2od_sk_1']);

$TAA_2OD_source_parent_b = mysql_real_escape_string($_POST['TAA_2OD_source_parent_b']);

$TAA_2od_lp_2 = mysql_real_escape_string($_POST['TAA_2od_lp_2']);

$TAA_2od_sk_2 = mysql_real_escape_string($_POST['TAA_2od_sk_2']);

$TAA_2od_lp_3 = mysql_real_escape_string($_POST['TAA_2od_lp_3']);

$TAA_2od_sk_3 = mysql_real_escape_string($_POST['TAA_2od_sk_3']);

$TAA_2od_d = mysql_real_escape_string($_POST['TAA_2od_d']);

$TAA_2od_lp_4 = mysql_real_escape_string($_POST['TAA_2od_lp_4']);

$TAA_3 = mysql_real_escape_string($_POST['TAA_3']);

$TAA_4 = mysql_real_escape_string($_POST['TAA_4']);

$TAA_B = mysql_real_escape_string($_POST['TAA_B']);

$cp_a_1 = mysql_real_escape_string($_POST['cp_a_1']);

$cp_a_1_no = mysql_real_escape_string($_POST['cp_a_1_no']);

$cp_b_1 = mysql_real_escape_string($_POST['cp_b_1']);

$cp_b_1_no = mysql_real_escape_string($_POST['cp_b_1_no']);

$cp_c_1 = mysql_real_escape_string($_POST['cp_c_1']);

$cp_c_1_no = mysql_real_escape_string($_POST['cp_c_1_no']);

$usercf = $_SESSION['CFuser'];

$submitdate = mysql_real_escape_string($_POST['submitdate']);

$insertquery = "INSERT INTO survey(reigonid, devls, cln, cfn, cdb_m, cdb_d, cdb_y, tosc, osf, fl9_1, tr9_1, fl9_2, tr9_2, fl9_3, tr9_3, fl9_4, tr9_4, fl9_5, tr9_5, ing_10, ing_10_other, q11, PSES_asses_date, PSES_asses_name2, PSES_asses_tr_1, PSES_asses_lp_1, PSES_sk_one,PSES_asses_tr_2, PSES_asses_lp_2, PSES_sk_two, PSES_2OD_source_parent_a, PSES_2od_lp_1, PSES_2od_sk_1, PSES_2OD_source_parent_b, PSES_2od_lp_2, PSES_2od_sk_2,PSES_2od_c,PSES_2od_lp_3,PSES_2od_sk_3,PSES_2od_d,PSES_2od_lp_4,PSES_2od_sk_4,PSES_3,PSES_4,PSES_B,ASK_asses_date,AKS_asses_name,ASK_asses_tr_1,ASK_asses_lp_1,ASK_sk_one,ASK_asses_tr_2,ASK_asses_lp_2,ASK_sk_two,ASK_2od_c,ASK_2OD_source_parent_a,ASK_2od_lp_1,ASK_2od_sk_1,ASK_2OD_source_parent_b,ASK_2od_lp_2,ASK_2od_sk_2,ASK_2od_lp_3,ASK_2od_sk_3,ASK_2od_d,ASK_2od_lp_4,ASK_2od_sk_4,ASK_3,ASK_4,ASK_B,TAA_asses_date,TAA_asses_name,TAA_asses_tr_1,TAA_asses_lp_1,TAA_sk_one,TAA_asses_tr_2,TAA_asses_lp_2,TAA_sk_two,TAA_2od_c,TAA_2OD_source_parent_a,TAA_2od_lp_1,TAA_2od_sk_1,TAA_2OD_source_parent_b,TAA_2od_lp_2,TAA_2od_sk_2,TAA_2od_lp_3,TAA_2od_sk_3,TAA_2od_d,TAA_2od_lp_4,TAA_3,TAA_4,TAA_B,cp_a_1,cp_a_1_no,cp_b_1,cp_b_1_no,cp_c_1,cp_c_1_no,usercosf,submitdate)

 Values

  ('".$reigonid."','".$devlschool."','".$cln."','".$cfn."','".$cdb_m."','".$cdb_d."','".$cdb_y."','".$tosc."','".$osf."','".$fl9_1."','".$tr9_1."','".$fl9_2."','".$tr9_2."','".$fl9_3."','".$tr9_3."','".$fl9_4."','".$tr9_4."','".$fl9_5."','".$tr9_5."','".$ing_10."','".$ing_10_other."','".$q11."','".$PSES_asses_date."','".$PSES_asses_name2."','".$PSES_asses_tr_1."','".$PSES_asses_lp_1."','".$PSES_sk_one."','".$PSES_asses_tr_2."','".$PSES_asses_lp_2."','".$PSES_sk_two."','".$PSES_2OD_source_parent_a."','".$PSES_2od_lp_1."','".$PSES_2od_sk_1."','".$PSES_2OD_source_parent_b."','".$PSES_2od_lp_2."','".$PSES_2od_sk_2."','".$PSES_2od_c."','".$PSES_2od_lp_3."','".$PSES_2od_sk_3."','".$PSES_2od_d."','".$PSES_2od_lp_4."','".$PSES_2od_sk_4."','".$PSES_3."','".$PSES_4."','".$PSES_B."','".$ASK_asses_date."','".$AKS_asses_name."','".$ASK_asses_tr_1."','".$ASK_asses_lp_1."','".$ASK_sk_one ."','".$ASK_asses_tr_2."','".$ASK_asses_lp_2."','".$ASK_sk_two."','".$ASK_2od_c."','".$ASK_2OD_source_parent_a."','".$ASK_2od_lp_1."','".$ASK_2od_sk_1."','".$ASK_2OD_source_parent_b."','".$ASK_2od_lp_2."','".$ASK_2od_sk_2."','".$ASK_2od_lp_3."','".$ASK_2od_sk_3."','".$ASK_2od_d."','".$ASK_2od_lp_4."','".$ASK_2od_sk_4."','".$ASK_3."','".$ASK_4."','".$ASK_B."','".$TAA_asses_date."','".$TAA_asses_name."','".$TAA_asses_tr_1."','".$TAA_asses_lp_1."','".$TAA_sk_one."','".$TAA_asses_tr_2."','".$TAA_asses_lp_2."','".$TAA_sk_two."','".$TAA_2od_c."','".$TAA_2OD_source_parent_a."','".$TAA_2od_lp_1."','".$TAA_2od_sk_1."','".$TAA_2OD_source_parent_b."','".$TAA_2od_lp_2."','".$TAA_2od_sk_2."','".$TAA_2od_lp_3."','".$TAA_2od_sk_3."','".$TAA_2od_d."','".$TAA_2od_lp_4."','".$TAA_3."','".$TAA_4."','".$TAA_B."','".$cp_a_1."','".$cp_a_1_no."','".$cp_b_1."','".$cp_b_1_no."','".$cp_c_1."','".$cp_c_1_no."','".$usercosf."','".$submitdate."')";

  

  $resultinsert = mysql_query($insertquery) or die(mysql_error());

				header("Location: thank.php"); 

				//$_POST['schoolmeny'] = "";

				//$_POST['districtmenu'] = "";

				}

							

				}

				

?>

Open in new window

0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 9

Author Comment

by:syedasimmeesaq
ID: 20422640
>>>your_date_field = CURRENT_DATE in your SQL statement

how would I change my code to do that

Thanks
0
 
LVL 20

Accepted Solution

by:
steelseth12 earned 300 total points
ID: 20422664

<?php

session_start();

 

if ($_SESSION['CFuser'] && $_SESSION['CFpass']) {//1

 

require_once('con_info.php');

if(isset($_POST["submit"]))

{//2

 

$reigonid = mysql_real_escape_string($_POST['reigonid']);

$devlschool = mysql_real_escape_string($_POST['devls']);

$cln = mysql_real_escape_string($_POST['cln']);

$cfn = mysql_real_escape_string($_POST['cfn']);

$cdb_m = mysql_real_escape_string($_POST['cdb_m']);

$cdb_d = mysql_real_escape_string($_POST['cdb_d']);

$cdb_y = mysql_real_escape_string($_POST['cdb_y']);

$tosc = mysql_real_escape_string($_POST['tosc']);

$osf = mysql_real_escape_string($_POST['osf']);

$fl9_1 = mysql_real_escape_string($_POST['fl9_1']);

$tr9_1 = mysql_real_escape_string($_POST['tr9_1']);

$fl9_2 = mysql_real_escape_string($_POST['fl9_2']);

$tr9_2 = mysql_real_escape_string($_POST['tr9_2']);

$fl9_3 = mysql_real_escape_string($_POST['fl9_3']);

$tr9_3 = mysql_real_escape_string($_POST['tr9_3']);

$fl9_4 = mysql_real_escape_string($_POST['fl9_4']);

$tr9_4 = mysql_real_escape_string($_POST['tr9_4']);

$fl9_5 = mysql_real_escape_string($_POST['fl9_5']);

$tr9_5 = mysql_real_escape_string($_POST['tr9_5']);

$ing_10 = mysql_real_escape_string($_POST['ing_10']);

$ing_10_other = mysql_real_escape_string($_POST['ing_10_other']);

$q11 = mysql_real_escape_string($_POST['q11']);

$PSES_asses_date = mysql_real_escape_string($_POST['PSES_asses_date']);

$PSES_asses_name2 = mysql_real_escape_string($_POST['PSES_asses_name2']);

$PSES_asses_tr_1 = mysql_real_escape_string($_POST['PSES_asses_tr_1']);

$PSES_asses_lp_1 = mysql_real_escape_string($_POST['PSES_asses_lp_1']);

$PSES_sk_one = mysql_real_escape_string($_POST['PSES_sk_one']);

$PSES_asses_tr_2  = mysql_real_escape_string($_POST['PSES_asses_tr_2 ']);

$PSES_asses_lp_2 = mysql_real_escape_string($_POST['PSES_asses_lp_2']);

$PSES_sk_two = mysql_real_escape_string($_POST['PSES_sk_two']);

$PSES_2OD_source_parent_a = mysql_real_escape_string($_POST['PSES_2OD_source_parent_a']);

$PSES_2od_lp_1 = mysql_real_escape_string($_POST['PSES_2od_lp_1']);

$PSES_2od_sk_1 = mysql_real_escape_string($_POST['PSES_2od_sk_1']);

$PSES_2OD_source_parent_b = mysql_real_escape_string($_POST['PSES_2OD_source_parent_b']);

$PSES_2od_lp_2 = mysql_real_escape_string($_POST['PSES_2od_lp_2']);

$PSES_2od_sk_2 = mysql_real_escape_string($_POST['PSES_2od_sk_2']);

$PSES_2od_c = mysql_real_escape_string($_POST['PSES_2od_c']);

$PSES_2od_lp_3 = mysql_real_escape_string($_POST['PSES_2od_lp_3']);

$PSES_2od_sk_3 = mysql_real_escape_string($_POST['PSES_2od_sk_3']);

$PSES_2od_d = mysql_real_escape_string($_POST['PSES_2od_d']);

$PSES_2od_lp_4 = mysql_real_escape_string($_POST['PSES_2od_lp_4']);

$PSES_2od_sk_4 = mysql_real_escape_string($_POST['PSES_2od_sk_4']);

$PSES_3 = mysql_real_escape_string($_POST['PSES_3']);

$PSES_4 = mysql_real_escape_string($_POST['PSES_4']);

$PSES_B = mysql_real_escape_string($_POST['PSES_B']);

$ASK_asses_date = mysql_real_escape_string($_POST['ASK_asses_date']);

$AKS_asses_name = mysql_real_escape_string($_POST['AKS_asses_name']);

$ASK_asses_tr_1 = mysql_real_escape_string($_POST['ASK_asses_tr_1']);

$ASK_asses_lp_1 = mysql_real_escape_string($_POST['ASK_asses_lp_1']);

$ASK_sk_one = mysql_real_escape_string($_POST['ASK_sk_one']);

$ASK_asses_tr_2 = mysql_real_escape_string($_POST['ASK_asses_tr_2']);

$ASK_asses_lp_2 = mysql_real_escape_string($_POST['ASK_asses_lp_2']);

$ASK_sk_two = mysql_real_escape_string($_POST['ASK_sk_two']);

$ASK_2od_c = mysql_real_escape_string($_POST['ASK_2od_c']);

$ASK_2OD_source_parent_a = mysql_real_escape_string($_POST['ASK_2OD_source_parent_a']);

$ASK_2od_lp_1 = mysql_real_escape_string($_POST['ASK_2od_lp_1']);

$ASK_2od_sk_1 = mysql_real_escape_string($_POST['ASK_2od_sk_1']);

$ASK_2OD_source_parent_b = mysql_real_escape_string($_POST['ASK_2OD_source_parent_b']);

$ASK_2od_lp_2 = mysql_real_escape_string($_POST['ASK_2od_lp_2']);

$ASK_2od_sk_2 = mysql_real_escape_string($_POST['ASK_2od_sk_2']);

$ASK_2od_lp_3 = mysql_real_escape_string($_POST['ASK_2od_lp_3']);

$ASK_2od_sk_3 = mysql_real_escape_string($_POST['ASK_2od_sk_3']);

$ASK_2od_d = mysql_real_escape_string($_POST['ASK_2od_d']);

$ASK_2od_lp_4 = mysql_real_escape_string($_POST['ASK_2od_lp_4']);

$ASK_2od_sk_4 = mysql_real_escape_string($_POST['ASK_2od_sk_4']);

$ASK_3 = mysql_real_escape_string($_POST['ASK_3']);

$ASK_4 = mysql_real_escape_string($_POST['ASK_4']);

$ASK_B = mysql_real_escape_string($_POST['ASK_B']);

$TAA_asses_date = mysql_real_escape_string($_POST['TAA_asses_date']);

$TAA_asses_name = mysql_real_escape_string($_POST['TAA_asses_name']);

$TAA_asses_tr_1 = mysql_real_escape_string($_POST['TAA_asses_tr_1']);

$TAA_asses_lp_1 = mysql_real_escape_string($_POST['TAA_asses_lp_1']);

$TAA_sk_one = mysql_real_escape_string($_POST['TAA_sk_one']);

$TAA_asses_tr_2 = mysql_real_escape_string($_POST['TAA_asses_tr_2']);

$TAA_asses_lp_2 = mysql_real_escape_string($_POST['TAA_asses_lp_2']);

$TAA_sk_two = mysql_real_escape_string($_POST['TAA_sk_two']);

$TAA_2od_c = mysql_real_escape_string($_POST['TAA_2od_c']);

$TAA_2OD_source_parent_a = mysql_real_escape_string($_POST['TAA_2OD_source_parent_a']);

$TAA_2od_lp_1 = mysql_real_escape_string($_POST['TAA_2od_lp_1']);

$TAA_2od_sk_1 = mysql_real_escape_string($_POST['TAA_2od_sk_1']);

$TAA_2OD_source_parent_b = mysql_real_escape_string($_POST['TAA_2OD_source_parent_b']);

$TAA_2od_lp_2 = mysql_real_escape_string($_POST['TAA_2od_lp_2']);

$TAA_2od_sk_2 = mysql_real_escape_string($_POST['TAA_2od_sk_2']);

$TAA_2od_lp_3 = mysql_real_escape_string($_POST['TAA_2od_lp_3']);

$TAA_2od_sk_3 = mysql_real_escape_string($_POST['TAA_2od_sk_3']);

$TAA_2od_d = mysql_real_escape_string($_POST['TAA_2od_d']);

$TAA_2od_lp_4 = mysql_real_escape_string($_POST['TAA_2od_lp_4']);

$TAA_3 = mysql_real_escape_string($_POST['TAA_3']);

$TAA_4 = mysql_real_escape_string($_POST['TAA_4']);

$TAA_B = mysql_real_escape_string($_POST['TAA_B']);

$cp_a_1 = mysql_real_escape_string($_POST['cp_a_1']);

$cp_a_1_no = mysql_real_escape_string($_POST['cp_a_1_no']);

$cp_b_1 = mysql_real_escape_string($_POST['cp_b_1']);

$cp_b_1_no = mysql_real_escape_string($_POST['cp_b_1_no']);

$cp_c_1 = mysql_real_escape_string($_POST['cp_c_1']);

$cp_c_1_no = mysql_real_escape_string($_POST['cp_c_1_no']);

$usercf = $_SESSION['CFuser'];

$insertquery = "INSERT INTO survey(reigonid, devls, cln, cfn, cdb_m, cdb_d, cdb_y, tosc, osf, fl9_1, tr9_1, fl9_2, tr9_2, fl9_3, tr9_3, fl9_4, tr9_4, fl9_5, tr9_5, ing_10, ing_10_other, q11, PSES_asses_date, PSES_asses_name2, PSES_asses_tr_1, PSES_asses_lp_1, PSES_sk_one,PSES_asses_tr_2, PSES_asses_lp_2, PSES_sk_two, PSES_2OD_source_parent_a, PSES_2od_lp_1, PSES_2od_sk_1, PSES_2OD_source_parent_b, PSES_2od_lp_2, PSES_2od_sk_2,PSES_2od_c,PSES_2od_lp_3,PSES_2od_sk_3,PSES_2od_d,PSES_2od_lp_4,PSES_2od_sk_4,PSES_3,PSES_4,PSES_B,ASK_asses_date,AKS_asses_name,ASK_asses_tr_1,ASK_asses_lp_1,ASK_sk_one,ASK_asses_tr_2,ASK_asses_lp_2,ASK_sk_two,ASK_2od_c,ASK_2OD_source_parent_a,ASK_2od_lp_1,ASK_2od_sk_1,ASK_2OD_source_parent_b,ASK_2od_lp_2,ASK_2od_sk_2,ASK_2od_lp_3,ASK_2od_sk_3,ASK_2od_d,ASK_2od_lp_4,ASK_2od_sk_4,ASK_3,ASK_4,ASK_B,TAA_asses_date,TAA_asses_name,TAA_asses_tr_1,TAA_asses_lp_1,TAA_sk_one,TAA_asses_tr_2,TAA_asses_lp_2,TAA_sk_two,TAA_2od_c,TAA_2OD_source_parent_a,TAA_2od_lp_1,TAA_2od_sk_1,TAA_2OD_source_parent_b,TAA_2od_lp_2,TAA_2od_sk_2,TAA_2od_lp_3,TAA_2od_sk_3,TAA_2od_d,TAA_2od_lp_4,TAA_3,TAA_4,TAA_B,cp_a_1,cp_a_1_no,cp_b_1,cp_b_1_no,cp_c_1,cp_c_1_no,usercosf,submitdate)

 Values

  ('".$reigonid."','".$devlschool."','".$cln."','".$cfn."','".$cdb_m."','".$cdb_d."','".$cdb_y."','".$tosc."','".$osf."','".$fl9_1."','".$tr9_1."','".$fl9_2."','".$tr9_2."','".$fl9_3."','".$tr9_3."','".$fl9_4."','".$tr9_4."','".$fl9_5."','".$tr9_5."','".$ing_10."','".$ing_10_other."','".$q11."','".$PSES_asses_date."','".$PSES_asses_name2."','".$PSES_asses_tr_1."','".$PSES_asses_lp_1."','".$PSES_sk_one."','".$PSES_asses_tr_2."','".$PSES_asses_lp_2."','".$PSES_sk_two."','".$PSES_2OD_source_parent_a."','".$PSES_2od_lp_1."','".$PSES_2od_sk_1."','".$PSES_2OD_source_parent_b."','".$PSES_2od_lp_2."','".$PSES_2od_sk_2."','".$PSES_2od_c."','".$PSES_2od_lp_3."','".$PSES_2od_sk_3."','".$PSES_2od_d."','".$PSES_2od_lp_4."','".$PSES_2od_sk_4."','".$PSES_3."','".$PSES_4."','".$PSES_B."','".$ASK_asses_date."','".$AKS_asses_name."','".$ASK_asses_tr_1."','".$ASK_asses_lp_1."','".$ASK_sk_one ."','".$ASK_asses_tr_2."','".$ASK_asses_lp_2."','".$ASK_sk_two."','".$ASK_2od_c."','".$ASK_2OD_source_parent_a."','".$ASK_2od_lp_1."','".$ASK_2od_sk_1."','".$ASK_2OD_source_parent_b."','".$ASK_2od_lp_2."','".$ASK_2od_sk_2."','".$ASK_2od_lp_3."','".$ASK_2od_sk_3."','".$ASK_2od_d."','".$ASK_2od_lp_4."','".$ASK_2od_sk_4."','".$ASK_3."','".$ASK_4."','".$ASK_B."','".$TAA_asses_date."','".$TAA_asses_name."','".$TAA_asses_tr_1."','".$TAA_asses_lp_1."','".$TAA_sk_one."','".$TAA_asses_tr_2."','".$TAA_asses_lp_2."','".$TAA_sk_two."','".$TAA_2od_c."','".$TAA_2OD_source_parent_a."','".$TAA_2od_lp_1."','".$TAA_2od_sk_1."','".$TAA_2OD_source_parent_b."','".$TAA_2od_lp_2."','".$TAA_2od_sk_2."','".$TAA_2od_lp_3."','".$TAA_2od_sk_3."','".$TAA_2od_d."','".$TAA_2od_lp_4."','".$TAA_3."','".$TAA_4."','".$TAA_B."','".$cp_a_1."','".$cp_a_1_no."','".$cp_b_1."','".$cp_b_1_no."','".$cp_c_1."','".$cp_c_1_no."','".$usercosf."',CURRENT_DATE)";

  

  $resultinsert = mysql_query($insertquery) or die(mysql_error());

                                header("Location: thank.php"); 

                                //$_POST['schoolmeny'] = "";

                                //$_POST['districtmenu'] = "";

                                }

                                                        

                                }

                                

?>

Open in new window

0
 
LVL 9

Author Comment

by:syedasimmeesaq
ID: 20422766
It still not inserting the date
Thanks
0
 
LVL 20

Expert Comment

by:steelseth12
ID: 20422781
It inserts everything else but doesnt insert the date ?? or the query fails ?
0
 
LVL 9

Author Comment

by:syedasimmeesaq
ID: 20422881
it inserts everything else besides the date and the session user
Thanks
0
 

Assisted Solution

by:danielatmyra
danielatmyra earned 100 total points
ID: 20422895
Your date format is wrong for MySQL
date("Y-m-d") should give you a proper date. Apparently you have your table set to dump in all 0s if it doesn't like the input rather than fail the insert.

Also I would highly recommend that you !DO NOT! use hidden fields to pass data back to yourself.
0
 
LVL 20

Expert Comment

by:steelseth12
ID: 20422967
syedasimmeesaq do

print $insertquery;


and comment out  header("Location: thank.php");

and show us the query

0
 
LVL 9

Author Comment

by:syedasimmeesaq
ID: 20422975
ok the problem was here

$submitdate = mysql_real_escape_string($_POST['submitdate']);

when I removed string escapes it worked. Thank you all
0
 

Expert Comment

by:danielatmyra
ID: 20423013
From code:
$usercf = $_SESSION['CFuser'];

From insert:
o."','".$usercosf."',CU
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
This article discusses four methods for overlaying images in a container on a web page
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now