Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Why wont any data insert into the table?


mondeo79

Recommended Posts

I am using the Customer Survey 1.0 contribution (link) and after a lot of tinkering have now got it "working" to the point that an email is sent to the customer requesting they complete the survey with a link to the survey, the link is validated so only valid customers can take the survey.

 

The issue I have is when the survey is completed a record is created in the survey table but the only two fields that contain any data are survey_id and survey_date - any of the input fields from the form are not inserted and each record just contains lots of zeros.

 

I have posted the code which controls putting the data into the table and one of the form fields to show the code used there - can anyone see why it wont insert the form data into the table?

 

Please note: This is not my contribution and I am just a PHP begineer so I dont know why it has been done this way if it indeed proves to be wrong.

 

 

 

  if (isset($HTTP_POST_VARS['action']) && ($HTTP_POST_VARS['action'] == 'process')) {

  $dateadded = date("Y-m-j H:i:s");

if ($error == false) {
  $sql_data_array = array('survey_order_num' => $order_num,
						  'survey_email' => $email,
						  'survey_date' => $dateadded,
						  'survey_q_a1' => $question_a1,
						  'survey_q_a2' => $question_a2,
						  'survey_q_a3' => $question_a3,
						  'survey_q_b1' => $question_b1,
						  'survey_q_b2' => $question_b2,
						  'survey_q_b3' => $question_b3,
						  'survey_q_b4' => $question_b4,
						  'survey_q_b5' => $question_b5,
						  'survey_q_c1' => $question_c1,
						  'survey_q_c2' => $question_c2,
						  'survey_q_c3' => $question_c3,
						  'survey_q_c4' => $question_c4,
						  'survey_q_c5' => $question_c5,
						  'survey_q_d1' => $question_d1,
						  'survey_q_d2' => $question_d2,
						  'survey_q_d3' => $question_d3,
						  'survey_q_d4' => $question_d4,
						  'survey_q_e1' => $question_e1,
						  'survey_q_e2' => $question_e2,
						  'survey_q_e3' => $question_e3,
						  'survey_q_e4' => $question_e4,
						  'survey_q_e5' => $question_e5,
						  'survey_q_e6' => $question_e6);


  tep_db_perform(TABLE_SURVEY, $sql_data_array);


  $survey_id = tep_db_insert_id();

  if (SESSION_RECREATE == 'True') {
	tep_session_recreate();
  }

  $survey_ordernum = '$survey_order_num';
  $survey_e_mail = $survey_email;
  $survey_q_a1 = $question_a1;
  $survey_q_a2 = $question_a2;
  $survey_q_a3 = $question_a3;
  $survey_q_b1 = $question_b1;
  $survey_q_b2 = $question_b2;
  $survey_q_b3 = $question_b3;
  $survey_q_b4 = $question_b4;
  $survey_q_b5 = $question_b5;
  $survey_q_c1 = $question_c1;
  $survey_q_c2 = $question_c2;
  $survey_q_c3 = $question_c3;
  $survey_q_c4 = $question_c4;
  $survey_q_c5 = $question_c5;
  $survey_q_d1 = $question_d1;
  $survey_q_d2 = $question_d2;
  $survey_q_d3 = $question_d3;
  $survey_q_d4 = $question_d4;
  $survey_q_e1 = $question_e1;
  $survey_q_e2 = $question_e2;
  $survey_q_e3 = $question_e3;
  $survey_q_e4 = $question_e4;
  $survey_q_e5 = $question_e5;
  $survey_q_e6 = $question_e6;

  tep_session_register('survey_id');
  tep_session_register('survey_ordernum');
  tep_session_register('survey_e_mail');
  tep_session_register('survey_q_a1');
  tep_session_register('survey_q_a2');
  tep_session_register('survey_q_a3');
  tep_session_register('survey_q_b1');
  tep_session_register('survey_q_b2');
  tep_session_register('survey_q_b3');
  tep_session_register('survey_q_b4');
  tep_session_register('survey_q_b5');
  tep_session_register('survey_q_c1');
  tep_session_register('survey_q_c2');
  tep_session_register('survey_q_c3');
  tep_session_register('survey_q_c4');
  tep_session_register('survey_q_c5');
  tep_session_register('survey_q_d1');
  tep_session_register('survey_q_d2');
  tep_session_register('survey_q_d3');
  tep_session_register('survey_q_d4');
  tep_session_register('survey_q_e1');
  tep_session_register('survey_q_e2');
  tep_session_register('survey_q_e3');
  tep_session_register('survey_q_e4');
  tep_session_register('survey_q_e5');
  tep_session_register('survey_q_e6');

  tep_redirect(tep_href_link(FILENAME_DEFAULT, '', 'SSL'));
}
 }

 

			  <tr>
			<td class="main" width="30%"><?php echo QUESTION_A1; ?></td>
			<td class="main" width="70%" ><?php echo tep_draw_radio_field('question_a1', '1') . '' . 1 . '    ' . tep_draw_radio_field('question_a1', '2') . '' . 2 . '    ' . tep_draw_radio_field('question_a1', '3') . '' . 3 . '    ' . tep_draw_radio_field('question_a1', '4') . '' . 4 . '    ' . tep_draw_radio_field('question_a1', '5') . '' . 5; ?></td>
		  </tr>

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...