07-16-2010, 11:19 PM
I'm creating a way so that users can make promotional codes from within the admin menu, and I got it to successfully create the promotional codes, but when it comes to checking it in the order form it never shows the check marks. Under my /includes/tpl/orderform.tpl I have
And under my ajax.php
Kinda just followed what was dont to email, expect my values are under a tht_promotions where the promo code is under the value 'name'. Can someone explain why this isn't working?
Code:
<tr>
<td>Promotional Code:</td>
<td><input type="text" name="name" id="name" onchange="check('name', this.value)" /></td>
<td align="left"><a title="Optional: Enter a valid promotional code" class="tooltip"><img src="<URL>themes/icons/information.png" /></a></td>
<td id="name" align="left"> </td>
</tr>And under my ajax.php
Code:
public function namecheck() {
global $main, $db;
if(!$main->getvar['name']) {
$_SESSION['check']['name'] = false;
echo 0;
return;
}
$query = $db->query("SELECT * FROM `<PRE>promotions` WHERE `name` = '{$main->getvar['name']}'");
if($db->num_rows($query) != 0) {
$_SESSION['check']['name'] = false;
echo 0;
return;
}
else {
if($main->check_name($main->getvar['name'])) {
$_SESSION['check']['name'] = true;
echo 1;
}
else {
$_SESSION['check']['name'] = false;
echo 0;
}
}Kinda just followed what was dont to email, expect my values are under a tht_promotions where the promo code is under the value 'name'. Can someone explain why this isn't working?