[nycphp-talk] Simple form-based selection and cookie-setting/g etting
Sexton, David
David.SextonJr at ubs.com
Thu Jul 31 15:57:35 EDT 2003
Exactly. Then you would set the cookie in the script designated by the
form's action attribute.
-----Original Message-----
From: Robert Dumas [mailto:rdumas at cmj.com]
Sent: Thursday, July 31, 2003 3:56 PM
To: 'NYPHP Talk'
Subject: RE: [nycphp-talk] Simple form-based selection and cookie-setting/g
etting
so if I'm reading this right, I want to do something like this?
<form name="mediaplayerchoice" id="mediaplayerchoice" method="post">
Preferred Media Player:<br />
<label><input type="radio" name="preferredmediaplayer" value="real"
onclick="document.mediaplayerchoice.submit();return false" /> RealOne
Player</label><br />
<label><input type="radio" name="preferredmediaplayer" value="wmp"
onclick="document.mediaplayerchoice.submit();return false" /> Windows Media
Player</label><br />
</form>
... and that will cause the form to submit the VALUE of whatever radio input
is clicked?
--RD
-----Original Message-----
From: Sexton, David [ mailto:David.SextonJr at ubs.com
<mailto:David.SextonJr at ubs.com> ]
Sent: Thursday, July 31, 2003 3:39 PM
To: 'NYPHP Talk'
Subject: RE: [nycphp-talk] Simple form-based selection and
cookie-setting/g etting
You are trying to execute PHP code on the client. What you would want to do
is have Javascript submit the form
(onClick="document.mediaplayerchoice.submit();"). Then have your setcookie
call at the top of the processing page... like this:
setcookie("preferredmediaplayer",
$_POST['preferredmediaplayer'],time()+60*60*24*30,"/player/","cmj.com",0);
Basically, if you view the source of the web page after it loads as it is
now, there will be no code for the onClick event since the PHP code is
parsed beforehand and does not output anything. What you will have is the
cookie value always set to 'wmp' since you are overwriting it each time a
user hits this form.
HTH... let me know if it's still unclear.
Please do not transmit orders or instructions regarding a UBS account by
email. The information provided in this email or any attachments is not an
official transaction confirmation or account statement. For your protection,
do not include account numbers, Social Security numbers, credit card
numbers, passwords or other non-public information in your email. Because
the information contained in this message may be privileged, confidential,
proprietary or otherwise protected from disclosure, please notify us
immediately by replying to this message and deleting it from your computer
if you have received this communication in error. Thank you.
UBS Financial Services Inc.
UBS International Inc.
More information about the talk
mailing list