scout1idf Posted May 2, 2010 Share Posted May 2, 2010 I'm very new to PHP and to creating web sites. I've been searching various sites and through books looking for the answer to how to make my navigation system appear like this.... www.mysite.com/pages.php?f=7How do you get this part -> ?f=7 <-Thanks in advance for your help.. Link to comment Share on other sites More sharing options...
jeffman Posted May 2, 2010 Share Posted May 2, 2010 If that's really, really what you want, a combination of strrpos and substr will work.Or look here: $_SERVER['QUERY_STRING']If all you need is the value of f, then look here: $_GET['f'] Link to comment Share on other sites More sharing options...
scout1idf Posted May 2, 2010 Author Share Posted May 2, 2010 If that's really, really what you want........Can I assume by this part of your response, that it's not the preferable way to go? I ask because I see it on quite a few php sites. Link to comment Share on other sites More sharing options...
dsonesuk Posted May 2, 2010 Share Posted May 2, 2010 ?f=7 is a value (7) passed relating to specific ref (f), they start with ? after that & ?f=7&g=8&h=9.they are provided mainly by form input boxexs, radio, checkboxes etc, but also be used in link<a href="gotothispage.php?f=7&g=8&h=9">pass f, g, h reference values to gotothispage.php</a>check outvalues passed using GET method Link to comment Share on other sites More sharing options...
jeffman Posted May 2, 2010 Share Posted May 2, 2010 I didn't know what your goal was, and you didn't indicate what your skill level is, so I gave you some options that you could choose from.The "really, really" business was because most applications do not need to access an entire query string. They only need the value of a name-value pair. That is what the $_GET array is for.I'm not sure what you mean by "I see it on quite a few php sites." What is it? Do you mean "gotothispage.php?f=7"? Of course you see that a lot. As I said, accessing that data is what the $_GET array is for. If you mean getting the entire query string, I doubt you see that on a LOT of sites. But sometimes there is a need for it, and that is what $_SERVER['QUERY_STRING'] is for. Link to comment Share on other sites More sharing options...
scout1idf Posted May 2, 2010 Author Share Posted May 2, 2010 mud I didn't know what your goal was, and you didn't indicate what your skill level is, so I gave you some options that you could choose from.The "really, really" business was because most applications do not need to access an entire query string. They only need the value of a name-value pair. That is what the $_GET array is for.I'm not sure what you mean by "I see it on quite a few php sites." What is it? Do you mean "gotothispage.php?f=7"? Of course you see that a lot. As I said, accessing that data is what the $_GET array is for. If you mean getting the entire query string, I doubt you see that on a LOT of sites. But sometimes there is a need for it, and that is what $_SERVER['QUERY_STRING'] is for.I'll use this page as an example..In the address bar it shows....http://w3schools.invisionzone.com/index.php?showtopic=31266On my site the address bar shows.....http:// www.myfirstsite.zxq.net/web%20page%20stuff/floating_file/floating_points_of_light_links.phporhttp:// www.myfirstsite.zxq.net/web%20page%20stuff/floating_file/floating_points_of_light_info.phporhttp://www.myfirstsite.zxq.net/web%20page%..._light_home.phpetc.....I guess what I am asking is, what method is being used to access different pages on this site? How do I make mine look more "professional" (for lack of a better term)?As for my skill level, on a scale of 1-10, 10 being the best. I would have to say I'm around negative 24 and trying to learn mostly on my own.Most of this stuff is about as clear as mud to me. High school was a very long time ago and I didn't take any courses above general math/pre algebra and the high tech computers of "my day" were the Atari 800 and Commodore 64. I probably shouldn't have waited so long (2009 & 42 yrs old) to try to learn this stuff...... Link to comment Share on other sites More sharing options...
jeffman Posted May 2, 2010 Share Posted May 2, 2010 There is a technique called URL rewriting that probably handles the bulk of what you see on the net. I think you're not ready for that yet. :)The ?showtopic=31266 thing probably gives a script enough information to access a database. If you want to learn something like Wordpress, your URL's would look a lot like that. Steep learning curve, though.I do things like this with straight PHP. It works best when you are including the destination document within the source document. That way, the user never needs to see those big ugly addresses. You can also make a few things more efficient. It's a simple enough task for someone with a little PHP experience, but you need to know 8-10 little things, and 1-2 not so little things, and again, I don't know if you're up to it.How much do you want to learn all at once? Link to comment Share on other sites More sharing options...
scout1idf Posted May 2, 2010 Author Share Posted May 2, 2010 .....How much do you want to learn all at once? At this stage, I think a little at a time so it can all (try to) sink in.I think for now I may rename some of my files/folders so they are smaller in the address bar and maybe they will "look" better.Thanks for your help. Maybe my skill level will reach "0" some day..... Link to comment Share on other sites More sharing options...
dink Posted May 6, 2010 Share Posted May 6, 2010 mudI'll use this page as an example..In the address bar it shows....http://w3schools.invisionzone.com/index.php?showtopic=31266On my site the address bar shows.....http:// www.myfirstsite.zxq.net/web%20page%20stuff/floating_file/floating_points_of_light_links.phporhttp:// www.myfirstsite.zxq.net/web%20page%20stuff/floating_file/floating_points_of_light_info.phporhttp://www.myfirstsite.zxq.net/web%20page%..._light_home.phpetc.....I guess what I am asking is, what method is being used to access different pages on this site? How do I make mine look more "professional" (for lack of a better term)?As for my skill level, on a scale of 1-10, 10 being the best. I would have to say I'm around negative 24 and trying to learn mostly on my own.Most of this stuff is about as clear as mud to me. High school was a very long time ago and I didn't take any courses above general math/pre algebra and the high tech computers of "my day" were the Atari 800 and Commodore 64. I probably shouldn't have waited so long (2009 & 42 yrs old) to try to learn this stuff......I agree that it is difficult to learn but not impossible. I started out learning everything I could on the web, tutorials, viewing source code, ect. After I had learned everything I could from the web I took classes at a local community college. I graduated with highest honors at the age of 56. I can now program in C++, Java, VB, ASP, HTML, javascript, vbscript, and of course css. I am now learning php, osc, dnn, and joomla,,The most advanced technology when I was in high school were manual typewriters.. heheYou may have to work harder but if you really want it you will have it.Good Luck!dink Link to comment Share on other sites More sharing options...
dsonesuk Posted May 7, 2010 Share Posted May 7, 2010 http:// www.myfirstsite.zxq.net/web%20page%20stuff/floating_file/floating_points_of_light_links.phporhttp:// www.myfirstsite.zxq.net/web%20page%20stuff/floating_file/floating_points_of_light_info.phpif you talking about all '%20' within "web%20page%20stuff" thats because you have spaces within the directory name. There should no spaces in directory or file name. Any spaces will be converted to '%20', which is a code for a space, instead use "-", and make the name relative to your content.for example:content about holidaying Ghana, could have directory with filename "/africa/holiday-in-ghana.php" Link to comment Share on other sites More sharing options...
scout1idf Posted May 8, 2010 Author Share Posted May 8, 2010 I spent some time (days) renaming and reorganizing my site. For now, I have a shorter "signature" in the address bar.I'm still working on design aspects as well as content. Link to comment Share on other sites More sharing options...
dsonesuk Posted May 8, 2010 Share Posted May 8, 2010 advise using text name, instead of numbers 'info.php', 'guest-book.php' (all-lower-case-and-dashes-or-hyphens-between-spaces) more Search Engine Friendly, easy to identify what page relates to. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.