Jump to content

[SOLVED] Form variables to Session variables


xProteuSx

Recommended Posts

I am writing a small script that consists of two pages:  page one displays a bunch of values from a DB (ie. First Name, Last Name, Phone Number).  On this page you will find a form that follows this format:

 

<input type="text" name="edit_firstname" size="20" maxlength="35" value='Bob'>

<input type="text" name="edit_lastname" size="20" maxlength="35" value='Smith'>

<input type="text" name="edit_phone" size="20" maxlength="35" value='5552222'>

 

So when you see the page there will already be a 'default' value in each line (which is information extracted from a DB).  This works perfectly and has been tested thoroughly.

 

On the second page I have the following code:

 

$editfirstname = $_POST['edit_firstname'];

$editlastname = $_POST['edit_lastname'];

$editphone = $_POST['edit_phone'];

 

What I am trying to do is this:  the default value for edit_firstname from the form is 'Bob' by default, but the user can change this in the input field on the first page.  This value, whether changed or unchanged, should then be stored as edit_firstname and by calling up the function $_POST[''] on the second page I want to transfer the value to the variable $editfirstname.  However, it seems that $_POST['edit_firstname'] and the other fields do not return a value at all, hence $editfirstname = '' or $editfirstname = 'NULL'.  I have never tried to do things this way before.  I have spent too many hours trying to figure this out on my own.

 

Help!?!?!  TIA.

noidtluom is correct. because xProteuSx i correct, but since it is returning empty then he must have is <form method set to method="get"

 

one way of working with values post'd or get'd ;-) is to use the $_REQUEST because this collects both.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.