You are here: Re: [PHP] adding items on a input box and a checkbox. « PHP « IT news, forums, messages
Re: [PHP] adding items on a input box and a checkbox.

Posted by Greg Donald on 04/11/05 07:18

On Apr 10, 2005 9:26 PM, Louie Miranda <lmiranda@gmail.com> 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/

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация