tml Posted October 1, 2008 Share Posted October 1, 2008 HI, i where wondering how to make more pages in one like. index.php?page=1 or something like that... if any can help me with the code i be more than happy. im new to php. so i would like the code so i can just copy and paste, and i would like to know how my link should be etc. <a href index.php?page=1.... Quote Link to comment https://forums.phpfreaks.com/topic/126602-solved-one-php-file/ Share on other sites More sharing options...
Maq Posted October 1, 2008 Share Posted October 1, 2008 HI, i where wondering how to make more pages in one like. index.php?page=1 or something like that... Sorry I would like to help you but I don't understand exactly what you want or are trying to accomplish. Could you give an example or be more specific? Quote Link to comment https://forums.phpfreaks.com/topic/126602-solved-one-php-file/#findComment-654671 Share on other sites More sharing options...
tml Posted October 1, 2008 Author Share Posted October 1, 2008 i can try... something like this: i want to make my layout in index.php so my menu are there on all pages like home href=index.php news href=index.php?id1 something els href=index.php?id2 then i make the code so rest only be on the page i want (index.php) index hej index.php?id1 new index.php?id2 something and keep making new sites without change menu and layout. i know i can do it with include page's but i just want one dokument i know the code in asp if u know anything about that. <% id=Request.QueryString("id"): if id="" then id=0 Select case id case 0 ' forside %> page index <% case 1 ' default.asp2?id=1 %> page 1 <% case 2 ' default.asp2?id=2 %> <% case 3 ' default.asp2?id=3 %> <% case else ' alle andre %> <% End Select %> and link would be href=default.asp2?id=1 and so Quote Link to comment https://forums.phpfreaks.com/topic/126602-solved-one-php-file/#findComment-654674 Share on other sites More sharing options...
Maq Posted October 1, 2008 Share Posted October 1, 2008 You can grab the HTTP variables by using $_GET[''];. You also need to have id=# like in you ASP example, not id2. For example: // For page index.php?id=1 if ($_GET['id'] == 1) { //Display info for ID 1 } if ($_GET['id'] == 1) { //Display info for ID 2 } You can also break it up into case statements like the one in your ASP code... Does this help? Let me know! Quote Link to comment https://forums.phpfreaks.com/topic/126602-solved-one-php-file/#findComment-654676 Share on other sites More sharing options...
tml Posted October 1, 2008 Author Share Posted October 1, 2008 i did put the following in my php document i tryid open, then it just report with some text. like i said im new so i just need to copy and paste hehe, but are the not suppose to be a opening line like <?php or something? but thx for u helping if ($_GET['id'] == 1) { <?php echo "hej side 1"; ?> //Display info for ID 1 } if ($_GET['id'] == 2) { <?php echo "hej side 2"; ?> //Display info for ID 2 } Quote Link to comment https://forums.phpfreaks.com/topic/126602-solved-one-php-file/#findComment-654686 Share on other sites More sharing options...
Maq Posted October 1, 2008 Share Posted October 1, 2008 First, please use the code tags, make life easier for everyone. Second, you're using the <?php and ?> tags in the wrong place... All the code you posted is PHP, try this: if ($_GET['id'] == 1) { echo "hej side 1"; //Display info for ID 1 } if ($_GET['id'] == 2) { echo "hej side 2"; //Display info for ID 2 } ?> Quote Link to comment https://forums.phpfreaks.com/topic/126602-solved-one-php-file/#findComment-654694 Share on other sites More sharing options...
tml Posted October 1, 2008 Author Share Posted October 1, 2008 that worked, have been looking for this, for several days now, i thank you so much. i been told if u use mysql then u should use php and not asp, and since im going to set up my own server then linux are free and windows not hehe thx Quote Link to comment https://forums.phpfreaks.com/topic/126602-solved-one-php-file/#findComment-654704 Share on other sites More sharing options...
Maq Posted October 1, 2008 Share Posted October 1, 2008 If you decide to use MySQL you should use PHP, makes life easier. Plus it's open source and all free! Glad I could help tml, remember if your topic is solved please click the solved button. Good luck! Quote Link to comment https://forums.phpfreaks.com/topic/126602-solved-one-php-file/#findComment-654709 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.