User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 402,044 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,442 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 325 | Replies: 6
Reply
Join Date: Aug 2007
Posts: 154
Reputation: tanha is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
tanha tanha is offline Offline
Junior Poster

use POST variable with second form

  #1  
Jul 6th, 2008
Hi.
I have two forms with the following names and properties:
1. register.php --- ----- action="register-exec.php" --- method="POST"
2. register-exec.php --- action="register-exec.php" --- method="POST"


After submitting the register.php, I used session in register-exec.php to store the value of the register.php for later use as follow:

session_start();
$_SESSION['bookTitle'] = $_POST['txtBookTitle'];
$_SESSION['bookInfo'] = $_POST['txtBookInfo'];

Then after submitting the register-exec.php, I wanted to use those session variables, as follow:
if( isset($_POST['register-exec']) ){
     echo $bookTitle;
     echo $_SESSION['bookTitle'];
}

None of them work?
what is wrong ???
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Nov 2007
Location: Bangalore, India
Posts: 3,098
Reputation: nav33n has a spectacular aura about nav33n has a spectacular aura about 
Rep Power: 8
Solved Threads: 239
nav33n's Avatar
nav33n nav33n is offline Offline
Posting Sensei

Re: use POST variable with second form

  #2  
Jul 6th, 2008
I hope you have session_start in all the required pages. If so, you can try to print out the session variables first, to see if it really has the values.
Try print_r($_SESSION); in all the pages and check if the session variables are really storing any values.
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.

*PM asking for help will be ignored*
Reply With Quote  
Join Date: Aug 2007
Posts: 154
Reputation: tanha is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
tanha tanha is offline Offline
Junior Poster

Re: use POST variable with second form

  #3  
Jul 6th, 2008
I stored the session in the register-exec.php, and in the same page I would like use those session variables, but when I use the echo and print_r, nothing display, I before Posting it is OK, but after that it is working.
Reply With Quote  
Join Date: Nov 2007
Location: Bangalore, India
Posts: 3,098
Reputation: nav33n has a spectacular aura about nav33n has a spectacular aura about 
Rep Power: 8
Solved Threads: 239
nav33n's Avatar
nav33n nav33n is offline Offline
Posting Sensei

Re: use POST variable with second form

  #4  
Jul 6th, 2008
Can you post your code ?
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.

*PM asking for help will be ignored*
Reply With Quote  
Join Date: Jul 2008
Location: Hyderabad,India.
Posts: 538
Reputation: Shanti Chepuru is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 53
Shanti Chepuru's Avatar
Shanti Chepuru Shanti Chepuru is offline Offline
Posting Pro

Re: use POST variable with second form

  #5  
Jul 7th, 2008
k..
I think u hav to use the seesion registrstion in your first page means in register.php .Then you can retrieve those session variables in the page where ever u want..


Thanks.
Reply With Quote  
Join Date: Jul 2008
Location: Hyderabad,India.
Posts: 538
Reputation: Shanti Chepuru is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 53
Shanti Chepuru's Avatar
Shanti Chepuru Shanti Chepuru is offline Offline
Posting Pro

Re: use POST variable with second form

  #6  
Jul 7th, 2008
You have to use this code in register.php
Try this ...
  1. session_start();
  2. $_SESSION['bookTitle'] = $_POST['txtBookTitle'];
  3. $_SESSION['bookInfo'] = $_POST['txtBookInfo'];
Last edited by peter_budo : Jul 7th, 2008 at 6:46 am. Reason: Keep It Organized - please use [code] tags
Reply With Quote  
Join Date: Aug 2007
Posts: 154
Reputation: tanha is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
tanha tanha is offline Offline
Junior Poster

Re: use POST variable with second form

  #7  
Jul 7th, 2008
Hi.
Thanks for replying. Finally I used the <Input Hidden /> element of the form. and it worked well.

I will use the posted comments too.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb PHP Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the PHP Forum

All times are GMT -4. The time now is 11:27 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC