|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Inserting cookie into hidden form field
I'm a non-programmer. I was given two snippets of php to use in my webpage that reads a cookie for the user's id and then puts that ID into a field in the page's PayPal payment form. It worked great until I had a drive crash. After restoring the page I must have missed something, because it no longer inserts the ID into the Paypal field.
Here is the code as I have it now: Just inside the <body> tag is this to read teh cookie that has already been set (I've confirmed that the cookies are being set: <? $pid = $HTTP_COOKIE_VARS['Ref_ID']; ?> -------------- Here is the code that is added to the PayPal Form in an attempt to create the custom field containing the ID. <input type="hidden" name="custom" value="<? echo "$pid"; ?>"> I have tried altering this every logical way possible and look through a couple of books, but just can't figure out what I'm missing. Thanks in advance for any suggestions on fixing this or changing the method entirely. Mike |
|
#2
|
|||
|
|||
|
RE: Inserting cookie into hidden form field
Have you by any change reinstalled PHP?
Newer versions of PHP have by default the register_globals set to OFF (as of version 4.1.2); you may find your cookie data in $_COOKIE instead of in $HTTP_COOKIE_VARS |
|
#3
|
|||
|
|||
|
RE: Inserting cookie into hidden form field
This server is on 4.12. How do I set the globals to true? Is there a config file that can be edited directly from ssh, or do I need to re-compile?
|
|
#4
|
|||
|
|||
|
RE: Inserting cookie into hidden form field
I discovered the .ini file. I thought that instead of globals I'd try your second suggestion but it did not work. Still not pulling in the variable.
<? $pid = $_COOKIE['Ref_ID']; ?> and then <input type="hidden" name="custom" value="<? echo "$pid"; ?>"> |
|
#5
|
|||
|
|||
|
RE: Inserting cookie into hidden form field
I'm very confused now. I verified that my php.ini file already has globals turned on. So I really don't know why my original code snippet is not working.
Can anyone see a basic flaw in it? |
|
#6
|
|||
|
|||
|
RE: RE: Inserting cookie into hidden form field
Quote:
not really; I think you will need to debug this thing. You say you verified that the cookie was created; did you also check it's contents? When you create it and do a print_r($HTTP_COOKIE_VARS) do you also get the contents in your script? Have you turned on error_reporting? Do you get notices or warnings? |
![]() |
| Viewing: Codewalkers Forums > Other Technologies > Client Side Things > Inserting cookie into hidden form field |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|