| | |
Trying to pass ampersand through query strings in URL
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Nov 2008
Posts: 77
Reputation:
Solved Threads: 0
Thank you for the tutorial last time on query strings
It worked for me, this is my working query string:
However, I'm trying to get my PHP URLs with query strings that have multiple pages to look like this:
I can get the question mark in query string URLs with no problem, but the ampersand has proven difficult for me to get right.
How would I be able to do this in PHP?
It worked for me, this is my working query string:
php Syntax (Toggle Plain Text)
<? $i=$_GET['vehicle']; switch ($i) { case Chrysler: include("chryslernew.php"); break; case Chevrolet: include("chevnew.php"); break; default: echo "include ("nopage.php")"; } ?>
However, I'm trying to get my PHP URLs with query strings that have multiple pages to look like this:
PHP Syntax (Toggle Plain Text)
http://library.digiguide.com/lib/programmenextshowing/238308&hPage=3
I can get the question mark in query string URLs with no problem, but the ampersand has proven difficult for me to get right.
How would I be able to do this in PHP?
Last edited by peter_budo; Jul 24th, 2009 at 3:40 pm. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks) and [icode] (inline code) tags.
•
•
Join Date: Nov 2008
Posts: 77
Reputation:
Solved Threads: 0
Thanks for that. Do I have to create a separate .htaccess or php file to get this to work?
I have http://www.mychevycars.com (virtual host)
and I want to split the pages (page1.php, page2.php) into:
It isn't quite working.
I have http://www.mychevycars.com (virtual host)
and I want to split the pages (page1.php, page2.php) into:
PHP Syntax (Toggle Plain Text)
http://www.mychevycars.com/aveo/3door&hPage=1 http://www.mychevycars.com/aveo/3door&hPage=2 http://www.mychevycars.com/aveo/3door&hPage=3
It isn't quite working.
Last edited by whitestream6; Jul 24th, 2009 at 11:36 am.
•
•
Join Date: Dec 2008
Posts: 43
Reputation:
Solved Threads: 3
The query string starts after the "?" sign. The first variable must follow the "?" sign which indicates the end of the url path and start of query string variables. Further variables are then seperated by "&" sign. So to access hPage value fro the url it must be like this
http://www.mychevycars.com/aveo/3door?hPage=1 instead of http://www.mychevycars.com/aveo/3door&hPage=1
http://www.mychevycars.com/aveo/3door?hPage=1 instead of http://www.mychevycars.com/aveo/3door&hPage=1
maSteR of aLL, jAck oF NoNe
•
•
Join Date: Nov 2008
Posts: 77
Reputation:
Solved Threads: 0
What would I have to do to my query string?:
PHP Syntax (Toggle Plain Text)
<? $i=$_GET['carname']; switch ($i) { case 1: include("1.php"); break; case 2: include("2.php"); break; default: echo "page not found!!!!"; } ?>
![]() |
Similar Threads
- How to hide query string in url with .htaccess (PHP)
- Url Rewriting??? (PHP)
- URL Rewriting pass query string (Linux Servers and Apache)
- Query strings-passing 2 variables (ASP.NET)
- How to pass a whole table to another form? (Visual Basic 4 / 5 / 6)
- Hiding URL extension - mod_rewrite (IT Professionals' Lounge)
- PHP or ASP (Search Engine Optimization)
- Maximum word count for the URL (Search Engine Optimization)
- C - http post -how do u pass url? and how to post a file? (C)
Other Threads in the PHP Forum
- Previous Thread: SQLiteDatabase Error ...!
- Next Thread: Keep data from writing to table
Views: 645 | Replies: 6
| Thread Tools | Search this Thread |
Tag cloud for PHP
.htaccess access ajax alexa apache api array beginner beneath binary broadband broken cakephp checkbox class cms code cron curl database date directory display download dynamic echo email error file files folder form forms function functions google href htaccess html image include insert integration ip java javascript joomla jquery limit link login loop mail menu methods mlm mod_rewrite multiple mysql oop parse paypal pdf php problem query radio random recursion redirect regex remote script search select server sessions sms smtp soap source space speed sql structure syntax system table tutorial update updates upload url validation validator variable video web xml youtube





