Re: [PHP] adding items on a input box and a checkbox.

2005-04-10 Thread Louie Miranda
> It's possible, but what's the point of having a qty and a checkbox?

Because, i want my QTY(input) form to be edited right away.

Its the basic code.
-- 
Louie Miranda
http://www.axishift.com -- under development


Re: [PHP] adding items on a input box and a checkbox.

2005-04-10 Thread Greg Donald
On Apr 10, 2005 9:26 PM, Louie Miranda <[EMAIL PROTECTED]> wrote:
> I am having difficulty thingking how can i both add a quantity on a item,
> and at the same time detect if my clients did check the box.
> 
> Like this:
> http://dev.axishift.com/php/qtybox/qtybox.html

I would test if the quantity is_numeric() and greater than 0.  Having
the text field for the qty _and_ a checkbox seems redundant.

> Here's the code i did, on how to catch the checkbox:
> 
> ### code ###
> foreach ($_GET as $varname => $value)
> $parameters[$varname] = $value;
> 
> if (empty($parameters["add"]))
> {
> die("Incorrect parameters");
> exit;

The exit will never be called.

> }
> 
> foreach($parameters as $itemName => $itemValue)
> {
> 
> if ($itemValue == "add") {
> end;
> } else {
> 
> $itemExists = "select count(*) from catchorders_pending where uniqueID =
> '$itemValue'";

You may not have included all of your code.. but this looks
exploitable.  What if I put ;delete from catchorders_pending where
1=1; in the blank?

> $itemExists_result = $dbData->getOne($itemExists);
> 
> if ($itemExists_result == 0) {
> $insertData = $dbData->query("INSERT INTO catchorders_pending (uid,uniqueID)
> values ('$uid','$itemValue')");
> } else {
> //print("exist: $itemValue");
> }; // end if exist
> 
> }; // end if itemvalue
> 
> }; // end of foreach
> ### code ###
> 
> Is it possible to add a input box, where i can add ex: quantity of items and
> at the same time they can check the box? is it possible on my code?

It's possible, but what's the point of having a qty and a checkbox?
  

-- 
Greg Donald
Zend Certified Engineer
http://destiney.com/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] adding items on a input box and a checkbox.

2005-04-10 Thread Louie Miranda
I am having difficulty thingking how can i both add a quantity on a item, 
and at the same time detect if my clients did check the box.

Like this:
http://dev.axishift.com/php/qtybox/qtybox.html

Here's the code i did, on how to catch the checkbox:

### code ###
foreach ($_GET as $varname => $value)
$parameters[$varname] = $value;

if (empty($parameters["add"]))
{
die("Incorrect parameters");
exit;
} 

foreach($parameters as $itemName => $itemValue)
{

if ($itemValue == "add") {
end;
} else {

$itemExists = "select count(*) from catchorders_pending where uniqueID = 
'$itemValue'";
$itemExists_result = $dbData->getOne($itemExists);

if ($itemExists_result == 0) {
$insertData = $dbData->query("INSERT INTO catchorders_pending (uid,uniqueID) 
values ('$uid','$itemValue')");
} else {
//print("exist: $itemValue");
}; // end if exist

}; // end if itemvalue

}; // end of foreach
### code ###

Is it possible to add a input box, where i can add ex: quantity of items and 
at the same time they can check the box? is it possible on my code?

please help!.
-- 
Louie Miranda
http://www.axishift.com -- under development