Jump to content

Passing variable to an other page..


tomks77

Recommended Posts

some body in an other post helped me with this problem, sending variables to an other page.using $_SESSION.. it worked>>, but only when i search for one record only, becouse the SESSION takes the id number that i will use in an other page when user click on "Edit".. now when i show all the records in a table, there will be one more column that have the word 'Edit'so when you find the record in the table just click on "edit" to take you to the edit page, so i did like this in the first page: print ("<td><a href=\"edit2.php?id='$db_field[id]'\">Edit</a></td></tr>" ); when you click on "Edit", you jump to the page Edit2.php, taking the variable 'id'. the problem is this: in the page edit2.php, the variable id is shown in the address bar, but an error keep happenning..UnDefined Variable id in line... i found its strange: why the program can not see the variable id, although it appears in the address bar!!

Link to comment
Share on other sites

View the page source of edit2.php. Look at the href of that link. Does the value of id look correctly formatted? I suspect it does not. For one thing, there should not be 'single' quotation marks arount the value.

Link to comment
Share on other sites

if i put it like this:print ("<td><a href=\"edit2.php?id='$db_field[id]'\">Edit</a></td></tr>" ); // ' $db_field[id] ' Or like this:print ("<td><a href=\"edit2.php?id=$db_field[id]\">Edit</a></td></tr>" ); / / id=$db_field[id] i still have the same error, in the address bar its like this: ocalhost/edit2.php?id=4so as you see, its right there.. id=4, but in the top of the page i have the error undefind variable.

Link to comment
Share on other sites

<?PHP include "/variables.php" ?> then in variables write<?PHP $var1 = {VARIABLE DETAIL};$var2 = {VARIABLE DETAIL};$var3 = {VARIABLE DETAIL}; ?> Thats all i can think of.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...