Jump to content


unset and refresh

  • Please log in to reply
1 reply to this topic

#1 bagnallc

  • Members
  • PipPipPip
  • Advanced Member
  • 40 posts

Posted 01 August 2006 - 11:44 AM


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

#2 Ninjakreborn

  • Members
  • PipPipPip
  • Information Technology Specialist
  • 3,922 posts
  • Age:33

Posted 01 August 2006 - 02:04 PM

<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.


Business Website: http://www.infotechnologist.biz

Personal Website: http://www.joyelpuryear.com

Blog Site: http://www.realmofwriting.com
Services: Web development, application development, mobile development, and custom development. All services listed on my website.

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users