Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 190
  • Last Modified:

date not inserting in mysql

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
syedasimmeesaq
Asked:
syedasimmeesaq
  • 7
  • 6
  • 3
  • +1
4 Solutions
 
steelseth12Commented:
<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
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
for MySQL, the date format for insert needs to be YYYY-MM-DD ...
0
 
steelseth12Commented:
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!

 
syedasimmeesaqAuthor Commented:
tried both. Still doesn't work
0
 
steelseth12Commented:
Also we do you dont you use the mysql CURRENT_DATE instead of sending the value from php ?

0
 
steelseth12Commented:
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
 
danielatmyraCommented:
What is your SQL command? If you insert the date field as NULL it will just use the current date.
0
 
syedasimmeesaqAuthor Commented:
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
 
syedasimmeesaqAuthor Commented:
>>>your_date_field = CURRENT_DATE in your SQL statement

how would I change my code to do that

Thanks
0
 
steelseth12Commented:

<?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
 
syedasimmeesaqAuthor Commented:
It still not inserting the date
Thanks
0
 
steelseth12Commented:
It inserts everything else but doesnt insert the date ?? or the query fails ?
0
 
syedasimmeesaqAuthor Commented:
it inserts everything else besides the date and the session user
Thanks
0
 
danielatmyraCommented:
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
 
steelseth12Commented:
syedasimmeesaq do

print $insertquery;


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

and show us the query

0
 
syedasimmeesaqAuthor Commented:
ok the problem was here

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

when I removed string escapes it worked. Thank you all
0
 
danielatmyraCommented:
From code:
$usercf = $_SESSION['CFuser'];

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

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 7
  • 6
  • 3
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now