leedude Posted July 24, 2006 Share Posted July 24, 2006 Is there some way to make send a GET or POST variable like a session variable, without using a field.Something like this:[code]<?php$_GET['data'] = "hello";echo "<a href = "page2.php">page 2</a>";?>[/code]Would produce: 86.131.190.81/page2.php?data=helloUsually i have to use a hidden field, which can get very tedious. Link to comment https://forums.phpfreaks.com/topic/15511-get-without-form/ Share on other sites More sharing options...
Joe Haley Posted July 24, 2006 Share Posted July 24, 2006 Do you mean passing variables via the get method in a hyperlink?If so:echo '<a href="page2.php?var=' . $val . '">';On page2.php:$_GET['var'] would contain the value of $val. Link to comment https://forums.phpfreaks.com/topic/15511-get-without-form/#findComment-62978 Share on other sites More sharing options...
kenrbnsn Posted July 24, 2006 Share Posted July 24, 2006 For parameters on the URL, you can just create the URL with those parameters, which then are recieved in the $_GET array:[code]<?php echo '<a href="page.php?data=hello">Page 2</a>'; ?>[/code]Ken Link to comment https://forums.phpfreaks.com/topic/15511-get-without-form/#findComment-62979 Share on other sites More sharing options...
leedude Posted July 24, 2006 Author Share Posted July 24, 2006 thanks.Just wondering: is there a way to do it with post? Link to comment https://forums.phpfreaks.com/topic/15511-get-without-form/#findComment-63067 Share on other sites More sharing options...
craygo Posted July 24, 2006 Share Posted July 24, 2006 use sessions instead. That way as long as the browser is open the variable can be used.Ray Link to comment https://forums.phpfreaks.com/topic/15511-get-without-form/#findComment-63078 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.