close ad
WARNING: Do Not Install the DREAMWEAVER CC 2017 or 2018 Update »
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

No cookis are being stored when i submit form

Thread began 8/11/2009 12:05 pm by jerniganj377713 | Last modified 8/11/2009 7:37 pm by Eric Mittman | 1327 views | 1 replies |

jerniganj377713

No cookis are being stored when i submit form

I am using a PHP page and trying to save contact information using the "remember me" checkbox functionality. I followed the gsg doc but no cookie is being saved when i submit the form. I check my browser's cookies and they are not in the list. I will post my code below, maybe you can find the fault? Thanks.

i have the bindings set for each field and the server behaviors to set each field.

the form is much longer so i will just paste the code that pertains to the cookies:

THE PHP:
if ((((isset($_POST["rememberMe"]))?$_POST["rememberMe"]:"") != "")) {
setcookie("contactName", "".((isset($_POST["contactName"]))?$_POST["contactName"]:"") ."", time()+(60*60*24*30), "/onlinereferral", "http://sandbox2.dev.web", 0);
}
if ((((isset($_POST["rememberMe"]))?$_POST["rememberMe"]:"") != "")) {
setcookie("contactEmail", "".((isset($_POST["contactEmail"]))?$_POST["contactEmail"]:"") ."", time()+(60*60*24*30), "/onlinereferral", "http://sandbox2.dev.web", 0);
}
if ((((isset($_POST["rememberMe"]))?$_POST["rememberMe"]:"") != "")) {
setcookie("contactPhone", "".((isset($_POST["contactPhone"]))?$_POST["contactPhone"]:"") ."", time()+(60*60*24*30), "/onlinereferral", "http://sandbox2.dev.web", 0);
}
if ((((isset($_POST["rememberMe"]))?$_POST["rememberMe"]:"") != "")) {
setcookie("physicianName", "".((isset($_POST["physicianName"]))?$_POST["physicianName"]:"") ."", time()+(60*60*24*30), "/onlinereferral", "http://sandbox2.dev.web", 0);
}
if ((((isset($_POST["rememberMe"]))?$_POST["rememberMe"]:"") != "")) {
setcookie("remember", "1", time()+(60*60*24*30), "/onlinereferral", "http://sandbox2.dev.web", 0);
}

THE FORM FIELDS:
<input name="contactName" type="text" class="input" id="contactName" value="<?php echo((isset($_COOKIE["contactName"]))?$_COOKIE["contactName"]:"") ?>" size="30" />
<input name="contactEmail" type="text" class="input" id="contactEmail" value="<?php echo((isset($_COOKIE["contactEmail"]))?$_COOKIE["contactEmail"]:"") ?>" size="40" />
<input name="contactPhone" type="text" class="input" id="contactPhone" value="<?php echo((isset($_COOKIE["contactPhone"]))?$_COOKIE["contactPhone"]:"") ?>" size="15" />
<input <?php if (!(strcmp(((isset($_COOKIE["remember"]))?$_COOKIE["remember"]:""),1))) {echo "checked=\"checked\"";} ?> name="rememberMe" id="rememberMe" type="checkbox" size="30" />
<input name="physicianName" type="text" class="input" id="physicianName" value="<?php echo((isset($_COOKIE["physicianName"]))?$_COOKIE["physicianName"]:"") ?>" size="30" />

Sign in to reply to this post

Eric Mittman

The php code looks ok for setting the cookies. The only part that I can see a potential problem with is the checkbox input you have in your form. You have it like this:

<input <?php if (!(strcmp(((isset($_COOKIE["remember"]))?$_COOKIE["remember"]:""),1))) {echo "checked=\"checked\"";} ?> name="rememberMe" id="rememberMe" type="checkbox" size="30" />

The problem is there is no value attribute, it is this value attribute that is being evaluated by the php code that is attempting to set the cookie. Please add in a value here, you can just set it to 1 and test the page. Let us know if this does not fix it up.

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...