Jay2391 Posted February 1, 2007 Share Posted February 1, 2007 okay here is what I am thinking I have some code anything that when runs displays "hello world!!!" So I want to create a link of a button that displays and removes the item in the same screen I know this is not correct and it dosen't have to be a button it can be a simple link I am carrying an ID value that i must preserve on the Self.PHP post... I know I am wrong but I am loooking for clues.. here are my toughts: print '<h4><form action = "self.php" method="post">$on=TRUE<p>'; if($on== FALSE and $off == TRUE){ <---- Current stage when oppening page code = TRUE: if(code == TRUE){ run code } } print '<br><input type="submit" name="submit" size"20" value="on"/><br /></h4>'; then have another button that says the oposite print '<h4><form action = "self.php" method="post">$on=false<p>'; if($on== TRUE and $off == FALSE){ code = TRUE: if(code == TRUE){ run code } } print '<br><input type="submit" name="submit" size"20" value="off"/><br /></h4>'; Quote Link to comment https://forums.phpfreaks.com/topic/36671-displaying-code-on-comand-onoff/ Share on other sites More sharing options...
Jay2391 Posted February 1, 2007 Author Share Posted February 1, 2007 that work FYI I figure it out... is there a better way let me know echo "<br><a href=\"tourney_admin.php?tourney_id=$tourney_id&switch=on\">Turn on </a>"; echo "<br><a href=\"tourney_admin.php?tourney_id=$tourney_id&switch=off\">Turn on </a>"; echo "<br>$switch"; if($switch == on){ Quote Link to comment https://forums.phpfreaks.com/topic/36671-displaying-code-on-comand-onoff/#findComment-174825 Share on other sites More sharing options...
wildteen88 Posted February 1, 2007 Share Posted February 1, 2007 Would you better of doing it in JavaScript rather than in PHP? Doing it in JavaScript will be easier to do and doesnt require page refreshes to show/hide a a code block on the page. Quote Link to comment https://forums.phpfreaks.com/topic/36671-displaying-code-on-comand-onoff/#findComment-174853 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.