Jump to content

Using Session $_POST on Form Submit


rostros

Recommended Posts

Hey Guys , having a little issue with a form submit which im hoping someone has the answer to, anyone who can help me solve this I will give $10 via paypal.

 

I have been using Session Variables for sometimes in Dreamweaver, I dont really hand code that much to be honest, so thats why i need your help. I have quite a large form which has around 25 textfields, checkboxes and Drop Down fields etc, also mutiple file fields for photos, my current issue is that the user sometimes gets a Timeout when uploading the files, when the user uses the 'Back' button all data is lost. I know it is possible to store all information into session variables just when the user submits the form. I have looked at examples on this forum and the web but found only snipplets

 

Okay....What I really need !

 

An Example of a basic session, storing the variables to the Server as soon as User has press Submit on the <FORM>, it wouldn't really matter about IF Statments to check if the session exist's, if you could so an example that would be great.

 

$textfield

$checkbox

$dropdown

 

Please note that I have one .php file and not both html / php files.

 

 

 

 

Link to comment
Share on other sites

when your form posts to the .php file use something like: (this is for session variables, you must always start with session_start() to use session variables at anytime)

 


<?php
//start session
session_start();

//save POST variables as SESSION variables
$_SESSION['textField1'] = $_POST['textField1'];
$_SESSION['textField2'] = $_POST['textField2'];

//etc...etc...

?>

 

but I dont' see why it would time out, how are you doing it? typical form for requesing form variables would:

<?php

$textField1 = $_POST['textField1']

//etc...

?>

 

are you having it postback to its self and doing the php there? or posting to another page?

 

you could try breaking it up, have them give some info, then click continue, and on the next page get those variable and save them as session variables and then have more info given etc and then just use all the session variables at the end because $_SESSION['object'] on one page can be called using that same expression on another page you just have to start with sesson_start()

Link to comment
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.