![]() |
|
Welcome to the Computer Webmaster Gaming Console Graphics Forum forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact contact us. |
| |||||||
| PHP PHP for some can be one of the hardest website programming codes, so do you need help on your PHP script, if it is php4, php5 or lower this is the place for you for any PHP help. |
![]() |
| | LinkBack | Thread Tools | Display Modes |
| | #1 | ||
| Hi Guys, I have a selection menu that is generated via php and a backend database. the code is working. What I want to do is take a selection from the menu then select a table of results based on that key. I have the code to select & build the table, but i am having problems tieing the selection box to trigger the table update. Javascript is out , incase it is disabled, I have no Ajax , all i have is PHP. Thanks Steve | |||
|
| | #2 | ||
| steve wrote: > Hi Guys, > > > I have a selection menu that is generated via php and a backend database. > the code is working. > > > What I want to do is take a selection from the menu then select a table of > results based on that key. > > I have the code to select & build the table, but i am having problems tieing > the selection box to trigger the table update. > > > Javascript is out , incase it is disabled, I have no Ajax , all i have is > PHP. Then you have only two options, reload the whole page or use frames, which is better, that you should ask at alt.html or do as you feel is easiest. Assuming we use one page (no frames), you need to give arguments to the links in your menu <a href="this.page?varibletobesent=1">The menu element 1</a> <a href="this.page?varibletobesent=2">The menu element 2</a> <a href="this.page?varibletobesent=3">The menu element 3</a> In the page you need to take care of the value sent, IMHO it's easiest to do that in a switch-case: <?PHP // place this where the table is supposed to be $drawtable=true; switch($_GET['varibletobesent']) { case 1: $query="SELECT * FROM Table1"; break; case 2: $query="SELECT * FROM Table2"; break; case 3: $query="SELECT * FROM Table3"; break; default: $drawtable=false; break; } if($drawtable) { //Do what you need to draw the table } else { if(isset($_GET['varibletobesent'])) { //give some nice error message } // draw the page section as it should be without the table } ?> Of course you may need to do all the table drawing in the switch case if you can't make a general drawing function for all tables. If you need to send more than one variable, then the anchor-tag could look something like: <a href="this.page?varibletobesent=1&nextpage=<? $nextpage?>">The menu element 1</a> the '&' is what you put between the variables to be sent (it's just the & character, but using the plain '&' will generate invalid code at w3c. -- //Aho | |||
|
| Featured Websites | ||||
|
![]() |
| Tags: help, menu, needed, selection |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Where is this menu located? | thekl0wn | Community Chat | 4 | 11-05-2007 6:52 AM |
| Menu using javascript | Poster | JavaScript | 1 | 06-07-2006 10:04 AM |
| Featured Websites | ||||
|