Greetings!
I'm trying to create a form (questionnaire) with radio buttons that based on the costumers' answers would select products from the database and display them. I used modified Contact Us page as a base for my form and its handler. For some reason handler page doesn't process variables that I'm passing through. I used var_dump to trace an input in the handler script, and it seems like my form vars are going through, but I still can't process them. Here's a peace of code from my tpl_skin_test_default.php
This is header_php.php that handles the formPHP Code:<?php echo zen_draw_form('skin_test', zen_href_link(FILENAME_SKIN_TEST, 'action=send')); ?>
<?php if (CONTACT_US_STORE_NAME_ADDRESS== '1') { ?>
<address><?php echo nl2br(STORE_NAME_ADDRESS); ?></address>
<?php } ?>
<?php
if (isset($_GET['action']) && ($_GET['action'] == 'success')) {
?>
<div class="mainContent success"><?php
// this where I select final product from database after questions were processed
$theProductId = $_GET['id'];
global $db;
$sql = "select products_model from " . TABLE_PRODUCTS . " where products_id = :productID:";
$sql = $db->bindVars($sql, ':productID:', $theProductId, 'integer');
$result = $db->Execute($sql);
if ($result->RecordCount() > 0) {
echo 'Model number = ' . $result->fields['products_model'];
} else {
echo 'Sorry, no record found for product number ' . $theProductId;
}
</div>
<div class="buttonRow"><?php echo zen_back_link() . zen_image_button(BUTTON_IMAGE_BACK, BUTTON_BACK_ALT) . '</a>'; ?></div>
<?php
} else {
?>
<?php if (DEFINE_CONTACT_US_STATUS >= '1' and DEFINE_CONTACT_US_STATUS <= '2') { ?>
<div id="contactUsNoticeContent" class="content">
<?php
/**
* require html_define for the contact_us page
*/
require($define_page);
?>
</div>
<?php } ?>
<?php if ($messageStack->size('contact') > 0) echo $messageStack->output('contact'); ?>
<form name="test" method="get">
<p>My age is <br />
<label>
<input type="radio" name="quest0" value="a1" id="quest0_0" />
20s</label>
<label>
<input type="radio" name="quest0" value="a2" id="quest0_1" />
30s</label>
<label>
<input type="radio" name="quest0" value="a3" id="quest0_2" />
40s</label>
<label>
<input type="radio" name="quest0" value="a4" id="quest0_3" />
50s</label>
<label>
<input type="radio" name="quest0" value="a5" id="quest0_4" />
60+</label>
<br />
</p>
<input name="submit" type="submit" value="Submit Test Results" />
</form>I think problem somewhere in this areaPHP Code:require(DIR_WS_MODULES . zen_get_module_directory('require_languages.php'));
$error = false;
if (isset($_GET['action']) && ($_GET['action'] == 'send')) {
//Here I tried to see what vars were passed
// var_dump($_GET,$_POST);
// exit;
if (isset($_GET['quest0']) && ($_GET['quest0'] == 'a3'))
{
zen_redirect(zen_href_link(FILENAME_SKIN_TEST, 'action=success&id=1')); //THIS ONE supposed to work when I get 'a3' radio button checked
}
else
{ zen_redirect(zen_href_link(FILENAME_SKIN_TEST, 'action=success&id=2')); // instead it always passes else variant}
}
Script ignores it or something.PHP Code:if (isset($_GET['quest0']) && ($_GET['quest0'] == 'a3'))
Do you have any idea how can I fix it? I appreciate any help! Thank you.


Reply With Quote
