Re: undefined variable

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> 2006/4/29, Smart Software <info@xxxxxxxxxxxxxxxxxx>:
> How can i add the content of the textbox?
> i tried this:
> <td width="40%"> <a href="<? echo
> "products.php?cat=$cat&quantity=$quantity&toevoegen=1&id=$rowType[7]";
> ?>"><img src="images/bestel1.gif" border="0"></a></td>
>
> but all i get is an error telling me there is a undefined varable


It looks like you're trying to get at $quantity, but have you pulled
it from the submitted form yet? If your form's method is "post" then
reference the quantity value with $_POST['quantity']; if your form's
method is "get", use $_GET['quantity'].

You sound very new to this, and the fact that you're building a
shopping cart is worrisome...so please read up on the importance of
verifying your form data, i.e. always "sanitize" submitted values
before using them in SQL calls. And simply check that the values you
get are what you expect, i.e. if you're expecting a number in
$_POST['quantity'], make sure it's a number...

By the way, values submitted in a form will be strings, so in the
example above you'd actually be checking for the *existence of numbers
only* in the string.  Good luck.

HTH,
John W

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



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux