bagnallc Posted August 1, 2006 Share Posted August 1, 2006 Hi,I want to include an option on my page which when pressed by a user will unset a variable and then refresh the page with variable now unset.Is there a way of doing this?I have included an example of code where this would be relevant//display the users selected country detailsif(isset($countryid)) { echo "<font color='red'>"; }echo "Country - "; if(isset($countryid)) {$countryrow = mysql_fetch_row($countryname);echo $countryrow[0] . "only."; }else { echo "NOT LIMITED"; }if(isset($countryid)) { echo "</font>"; }So in other words when variable $countryid is set, the above produces a country name and is highlighted red, when its not set it states "NOT LIMITED". I want a button that can be pressed when variable is set that will unset the variable and refresh page to show this has taken effect.any ideas?Many thanks Quote Link to comment https://forums.phpfreaks.com/topic/16199-unset-and-refresh/ Share on other sites More sharing options...
Ninjakreborn Posted August 1, 2006 Share Posted August 1, 2006 [code]<form name="test" id="test" action="samepage" method="post"><input name="whatever" id="whatever" type="submit" value="change" /></form>[/code]WHen they click that change buttonon the same page, it will refresh the page, have it run the following code or example.[code]<?phpif (isset($_POST['whatever'])) {unset($variablename);}?>[/code]Just modify it to meet your needs. Quote Link to comment https://forums.phpfreaks.com/topic/16199-unset-and-refresh/#findComment-67034 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.