Disabled fields and passing information

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
iampeter
Forum Newbie
Posts: 2
Joined: Sun Feb 08, 2004 11:58 pm

Disabled fields and passing information

Post by iampeter »

Ok heres my scenario:
On one page a user enters a name to search my database by and the results of which as well as the name typed in are displayed on the second page for the user to change accordingly.

Now on this second page i want to disable the text box containing the name typed in so that it cannot be edited because only the details associated with that name need to be edited.

I have tried to disable it by both making it simple a PRINT statement as well as changing the text TYPE to DISABLED TYPE='text' however in both situations the variable that stores the name becomes empty so when the user makes his appropriate changes and clicks 'continue' which then takes him to the confirmation page the name itself is not outputted, while all the changed information is.

So basically what im asking is how can i disable a text field on one page but have the information stored in it still pass onto the next one?
Illusionist
Forum Regular
Posts: 903
Joined: Mon Jan 12, 2004 9:32 pm

Post by Illusionist »

are you sure your passing the name to the other page?? using post or get? and then on the second page recieving it by soemthing like

Code: Select all

$name = $_GET['name'];
//or
$name = $_POST['name'];
//or
$name = $_REQUEST['name'];
valaridz
Forum Newbie
Posts: 4
Joined: Wed Feb 11, 2004 5:23 am

Re: Disabled fields and passing information

Post by valaridz »

iampeter wrote: So basically what im asking is how can i disable a text field on one page but have the information stored in it still pass onto the next one?
You can use javascript.
User avatar
JayBird
Admin
Posts: 4524
Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:

Post by JayBird »

i think i had the same problem with disabled fields not passing their values.

What you could do, is display the name in a disabled text field and store the value in a hidden field.

Mark
malcolmboston
DevNet Resident
Posts: 1826
Joined: Tue Nov 18, 2003 1:09 pm
Location: Middlesbrough, UK

Post by malcolmboston »

bech is right........

.......thats how i do it and it works
Post Reply