Jump to content
Updating IPB tonight Read more... ×


This topic is now archived and is closed to further replies.


unset and refresh

Recommended Posts


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 details
if(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

Share this post

Link to post
Share on other sites
[code]<form name="test" id="test" action="samepage" method="post">
<input name="whatever" id="whatever" type="submit" value="change" />
WHen they click that change button
on the same page, it will refresh the page, have it run the following code or example.

if (isset($_POST['whatever'])) {
Just modify it to meet your needs.

Share this post

Link to post
Share on other sites


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.