Help - Search - Member List - Calendar
Full Version: Read MySQL array, select one item and setcookie
WorkTheWeb Forums > Webmaster Resources > PHP Help
Support our Sponsors!
Taxi Driver
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.

Thanks in advance. I really appreciate it.

Tony
Taxi Driver wrote:
QUOTE
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


PHP Help | Linux Help | Web Hosting | Reseller Hosting | SSL Hosting
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2006 Invision Power Services, Inc.