Jump to content

Archived

This topic is now archived and is closed to further replies.

flyclassic

qns on cookie and forms.

Recommended Posts

Hi, i i've a following problem here,

For example, i've two php files, signup.php and process.php. The signup only allows user to key in their name and personal info, once submit, it will go into process.php

<signup.php>

Name - <input name="Name" type=text id="Name" value="<?php echo $_COOKIE['Name'];?>" size=40
maxlength=100>

Personal Info -
<input name="PInfo" type=text id="PInfo" value="<?php echo $_COOKIE['PInfo'];?>" size=40
maxlength=100>

submit button


<process.php>
setcookie (Pinfo, $_POST['Pinfo']);
setcookie (Name, $_POST['Name']);

if(!$PInfo ||!$Name){
echo "Personal Info or Name is a required field. Please key in again<br/>";
}
include 'signup.php';
exit();
...
.......
......
.


//If the user enters only one of the field, user will be asked to key in again with both fields filled up, and signup.php will be shown up again for user to key in again. Problem here is, the cookie i set doesn't appear in the field straight in the include 'signup.php' section. Unless i relocate back to signup.php it the cookies value won't appear. I want the user not to retype again without going back the previous page, but just retype from there Anybody knows how to solve this problem? I'm not sure if i explain well enough my situation but i hope somebody can help .. :)

Share this post


Link to post
Share on other sites
check this thread out:

[a href=\"http://www.phpfreaks.com/forums/index.php?showtopic=96378&hl=\" target=\"_blank\"]http://www.phpfreaks.com/forums/index.php?...topic=96378&hl=[/a]

Share this post


Link to post
Share on other sites
is there anyway for my cookie to appear after setting right after without refreshing?
any other useful way because, i can't use header (location: ) as i've further html tags inbetween

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.