Jump to content


qns on cookie and forms.

  • Please log in to reply
2 replies to this topic

#1 flyclassic

  • Members
  • PipPip
  • Member
  • 11 posts

Posted 26 June 2006 - 04:53 AM

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


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

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

submit button

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';

//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 .. :)

#2 .josh

  • Staff Alumni
  • .josh
  • 14,871 posts

Posted 26 June 2006 - 05:08 AM

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]
Did I help you? Feeling generous? Buy me lunch! 
Please, take the time and do some research and find out how much it would have cost you to get your help from a decent paid-for source. A "roll-of-the-dice" freelancer will charge you $5-$15/hr. A decent entry level freelancer will charge you around $15-30/hr. A professional will charge you anywhere from $50-$100/hr. An agency will charge anywhere from $100-$250/hr. Think about all this when soliciting for help here. Think about how much money you are making from the work you are asking for help on. No, we do not expect you to pay for the help given here, but donating a few bucks is a fraction of the cost of what you would have paid, shows your appreciation, helps motivate people to keep offering help without the pricetag, and helps make this a higher quality free-help community :)

#3 flyclassic

  • Members
  • PipPip
  • Member
  • 11 posts

Posted 27 June 2006 - 03:38 AM

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

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users