You are here: Re: Read MySQL array, select one item and setcookie « PHP Language « IT news, forums, messages
Re: Read MySQL array, select one item and setcookie

Posted by Tony on 07/08/05 01:56

Taxi Driver wrote:
> I have a MySql table that I select * and display all the results in a
> list on a web page. The web page displays fine. I want to click on
> one item and set a cookie with that id.
>
> I just need some help in setting the cookie when you click on one
> item.

How are you doing it right now?

For the setcookie() function, see http://us3.php.net/setcookie

Cookies have to be set before anything is output to the page, so you'll have
to call a script with the value of the selection. From how you describe it,
it would probably be easiest to do this with GET, then the script would
retrieve that value and set the cookie accordingly:

<?
if (isset($_GET["MyValue"])) { setcookie("My_Value",$_GET["MyValue"]); }
?>

--
Tony Garcia
Web Right! Development
Riverside, CA
www.WebRightDevelopment.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

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