fallenangel1983 Posted March 30, 2008 Share Posted March 30, 2008 hey guys, i want to do some validation on informatio that is to be updated in a table. before i can do this i need to retrieve the variables from previous html pages. is there a way i can do this? cheers Link to comment https://forums.phpfreaks.com/topic/98666-retrieving-a-variable/ Share on other sites More sharing options...
wmguk Posted March 30, 2008 Share Posted March 30, 2008 are you planning on passing the variables using a form? if so a simple $varname = $_GET['varname']; would do the job? Link to comment https://forums.phpfreaks.com/topic/98666-retrieving-a-variable/#findComment-504954 Share on other sites More sharing options...
fallenangel1983 Posted March 30, 2008 Author Share Posted March 30, 2008 does $_GET retrieve a variable set in another html page? Link to comment https://forums.phpfreaks.com/topic/98666-retrieving-a-variable/#findComment-504957 Share on other sites More sharing options...
darkhappy Posted March 30, 2008 Share Posted March 30, 2008 yes, if you create a form in that other page to post the information to the current page like: <form id="formid" name="formname" method="post" action="filename.php"> <input name="textinput" type="text"> <input type="submit" name="submit" value="submit" /> then in filename.php you would put" $var=$_POST['textinput'] so whatever they typed into the textbox on the first page and hit submit would then get stored into $var in filename.php. or instead of a text box you could have a drop down list or radio button or whatever. Link to comment https://forums.phpfreaks.com/topic/98666-retrieving-a-variable/#findComment-504962 Share on other sites More sharing options...
wmguk Posted March 30, 2008 Share Posted March 30, 2008 does $_GET retrieve a variable set in another html page? I think im understanding what you are trying to do, if you create a form that the user fills out on page1, then the form method is GET and it goes to page2.php. at the top of page2.php put the $_GET string i put earlier... this will only work if you are using a form, either for the user to input data or as hidden so they are already passed.... Link to comment https://forums.phpfreaks.com/topic/98666-retrieving-a-variable/#findComment-504963 Share on other sites More sharing options...
fallenangel1983 Posted March 30, 2008 Author Share Posted March 30, 2008 Right ok sorry for being too vague didnt mean to annoy. in another html page i am using the afore mentioned form and input box to send that variable to a specific page. however this will only send that variable to that specific page. i wish to access that variable now on a completly different page for use with php validation. I cannot use session varibles and this way of doing it..... <form name='blah' method='post' action='page.php'> <input name='blah' type='blah' value='blah'></form> will only send it to page.php I need the variable on page2.php and so i am assuming a fucntion would be needed. thanks for the input guys sorry for inconvienience Link to comment https://forums.phpfreaks.com/topic/98666-retrieving-a-variable/#findComment-504966 Share on other sites More sharing options...
darkhappy Posted March 30, 2008 Share Posted March 30, 2008 Right ok sorry for being too vague didnt mean to annoy. in another html page i am using the afore mentioned form and input box to send that variable to a specific page. however this will only send that variable to that specific page. i wish to access that variable now on a completly different page for use with php validation. I cannot use session varibles and this way of doing it..... <form name='blah' method='post' action='page.php'> <input name='blah' type='blah' value='blah'></form> will only send it to page.php I need the variable on page2.php and so i am assuming a fucntion would be needed. thanks for the input guys sorry for inconvienience if not session variables then store it into a SQL database and retrieve it on the other page.... Link to comment https://forums.phpfreaks.com/topic/98666-retrieving-a-variable/#findComment-504970 Share on other sites More sharing options...
fallenangel1983 Posted March 30, 2008 Author Share Posted March 30, 2008 It is already inside a table but it is a specific row of that table that the user selects from a list. what im trying to get is a record form a table. from a user stated ID. the table name is events and i need to retrieve the specific eventID that the user requests on a form submitted a few pages ago. i stated that session variables would not work. however i only know one way of doing them. Link to comment https://forums.phpfreaks.com/topic/98666-retrieving-a-variable/#findComment-504974 Share on other sites More sharing options...
darkhappy Posted March 30, 2008 Share Posted March 30, 2008 It is already inside a table but it is a specific row of that table that the user selects from a list. what im trying to get is a record form a table. from a user stated ID. the table name is events and i need to retrieve the specific eventID that the user requests on a form submitted a few pages ago. i stated that session variables would not work. however i only know one way of doing them. store the user's selection in new table on the first page. on the current page query the selection from the new table and put it in a variable, then query the original table where eventID='$variable'. Link to comment https://forums.phpfreaks.com/topic/98666-retrieving-a-variable/#findComment-504979 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.