Using double ? in php statement

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
jntcomputers
Forum Newbie
Posts: 1
Joined: Fri Aug 13, 2004 5:27 pm

Using double ? in php statement

Post by jntcomputers »

I am working on code that pulls other php pages into it according to what link you click. With simple pages, it is no problem. Just so you get the whole picture, it goes like this:

Code: Select all

<a href=index.php?x=1>click her</a>
Then there is an if, else if statement that uses the include statement to add the different pages into the template according to which link you click.

Ex.
original= login.php
replaced with index.php?x=1

The problem comes when forms or links that exist on the internal pages are clicked. Some have the PHP_SELF command and once the pages are parsed, if they refer to themselves, they 'break out' of the template. I replaced the php_self and references to the pages themselves with the above code and it worked fine, as long as the links or forms don't have ? in them already.

So, if I have a form action that is like login.php?action=blahblahblah
I can't replace the login.php with index.php?x=1. Does anyone have any ideas on how I can accomplish my goal, which is to have a template page that pulls in other pages in php, and have those pages work within the template?
User avatar
nigma
DevNet Resident
Posts: 1094
Joined: Sat Jan 25, 2003 1:49 am

Post by nigma »

if you do:

Code: Select all

index.php?x=1&action=blahblah
then include whatever page is associated with x being 1 (login.php you said) and things should work if you reference action correctly.
User avatar
m3mn0n
PHP Evangelist
Posts: 3548
Joined: Tue Aug 13, 2002 3:35 pm
Location: Calgary, Canada

Post by m3mn0n »

And more values can be added with more &'s.

The first variable is ? and the rest are all &.
Post Reply