Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

date not inserting in mysql

Posted on 2007-12-06
17
Medium Priority
?
189 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 6
  • 3
  • +1
17 Comments
 
LVL 20

Assisted Solution

by:steelseth12
steelseth12 earned 1200 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 143

Assisted Solution

by:Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3] earned 400 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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
 
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 1200 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 400 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

These days socially coordinated efforts have turned into a critical requirement for enterprises.
This article discusses four methods for overlaying images in a container on a web page
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

670 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