Jump to content

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 .. :)
Link to comment
https://forums.phpfreaks.com/topic/12903-qns-on-cookie-and-forms/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.