944,162 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 4857
  • PHP RSS
Mar 31st, 2007
0

Help with switch/case statement navigation

Expand Post »
Hey everyone. I'm trying to create a webpage where everything you click, it reloads in the main content div with the new page. Heres an example of what im talking about.

This is my main content.
PHP Syntax (Toggle Plain Text)
  1. <?php
  2. switch ($Content)
  3. {
  4. case register:
  5. echo "<a href=\register.php</a>";
  6. break;
  7. default:
  8. echo "Welcome to our online game!";
  9. }
  10. ?>

And this is the link that would go to the register page.
PHP Syntax (Toggle Plain Text)
  1. <tr><td colspan="2" align="left"><br>Not registered? <a href="<?php echo $_SERVER['PHP_SELF']; ?>?Content=register">Sign-Up!</a></td></tr>
I know I'm not implementing the switch/case statement correctly (otherwise it would be working lol) But if someone could show me how to make it reload the center div on each click?? Thanks!
Last edited by Barefootsanders; Mar 31st, 2007 at 7:59 pm.
Similar Threads
Reputation Points: 10
Solved Threads: 3
Junior Poster
Barefootsanders is offline Offline
165 posts
since Oct 2006
Apr 1st, 2007
0

Re: Help with switch/case statement navigation

Does the server you are working on have register_globals = on ? If not (and its more secure if register_globals is off) then you will need to get the $content variable like so:

[PHP]$Content = $_GET['Content'];[/PHP]

also register should be in quotes like so:

[PHP]case 'register':[/PHP]
Reputation Points: 17
Solved Threads: 14
Posting Whiz
DanceInstructor is offline Offline
355 posts
since Feb 2005
Apr 1st, 2007
0

Re: Help with switch/case statement navigation

ahh that worked. Thanks a bunch
Reputation Points: 10
Solved Threads: 3
Junior Poster
Barefootsanders is offline Offline
165 posts
since Oct 2006

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: Can someone pls translate this
Next Thread in PHP Forum Timeline: Unexpected parse error, I dont know what I'm doing wrong.





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC