[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

PHP3 and session handling

Posted on 2000-04-19
6
Medium Priority
?
314 Views
Last Modified: 2008-03-06
I am developing a Portal job application. There are 4 forms in that. I want to carry the information from all the forms to the last form. There when I click submit I have to update the local database and post to other sites. How can I carry the information from one form to another until the last form. BEcause there are 50 fields to be carried to the final form. Can I use cookies or session. Please help me in solving the problem. I'm new to PHP, using PHP ver3.0
0
Comment
Question by:balasundaram
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 8

Expert Comment

by:us111
ID: 2730551
Good question. I don't know if I have the answer.
I think that your browser can stored 4k for a cookie. If it's enough
for 50 fields, use cookies. But I know people who don't accept cookies.

<? setcookie("TestCookie[]","Test Value"); ?>

For native session, use php4.0
otherwise with php3 use phplib which allows session
http://phplib.netuse.de

0
 

Expert Comment

by:mrvithan
ID: 2732888
Welll.... It has so many solution to do ...
1. you might use <input type="hidden"> to keep a field data on a page to next page and go on...for example

page1 : <intput type="text" name="firstname" value="">

page 2: <input type="hidden" name="firstname" value="<?php echo $firstname ?>">
            <input type="text" name="lastname" value="">

page 3: <input type="hidden" name="firstname" value="<?php echo $firstname ?>">
            <input type="hidden" name="lastname" value="<?php echo $lastname ?>">
            <input type="text" name="age" value="">

With this solution you don't need to deal with session but your page is non-sense.

2: If you really want to use session, it goes through as same as the solution 1. for example

page1 : session_start()
            <intput type="text" name="firstname" value="">

page 2: session_register('firstname')
            <input type="text" name="lastname" value="">

page 3: session_register('firstname')
            session_register('lastname')
            <input type="text" name="age" value="">

someone else might has a better coding
but I suggest you to do this 'cause you willn't get any problem with data that keep in session variable isn't up-to-date


0
 
LVL 2

Expert Comment

by:freshmeat
ID: 2732915
use php lib
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Accepted Solution

by:
alexdg earned 200 total points
ID: 2742727
THE BEST SOLUTION IMHO =)

name all your form fields like:

<input type="" name="form[_REAL_FIELD_NAME_]" value="">

Later, to carry all the form elemnts on other pages use this code:

<?
reset($form);
while(list($value, $key) = each($form)) {
?>
<input type="hidden" name="form[<? echo $key ?>]" value="<? echo $value ?>">
<? } ?>

This will carry all fields you entered on previous pages as hidden form fields on future pages.
0
 

Expert Comment

by:Agent_Neo
ID: 2865458
On that last line why do you do this?
?>
<input type="hidden" name="form[<? echo $key ?>]" value="<? echo $value ?>">
<? } ?>

Why not just this? :)

print "<input type=\"hidden\" name=\"$form[$key]\" value=\"$value\">\n";

FULL CODE:

<?
reset($form);
while(list($value, $key) = each($form)) {

     print "<input type=\"hidden\" name=\"$form[$key]\" value=\"$value\">";

}
?>
0
 

Expert Comment

by:Agent_Neo
ID: 2865463
Opps :) change $form to just "form"
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
Suggested Courses

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question