473,382 Members | 1,261 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

SWITCH with a $_GET

I have a url that ends with ?pid=sqlall. I am using the following to
try and get at the "sqlall". I have read many sites to no avail.

switch ($_GET['pid']) {
case 'sqlall':
$page->assign('pagetitle', 'All Users');
$page->assign('tableheader', 'All Users');
$page->assign('sqlfile', 'sql_all.php');
break;
case 'sqlprof':
$page->assign('pagetitle', 'All Users');
$page->assign('tableheader', '» All User Profiles');
$page->assign('sqlfile', 'sql_prof.php');
break;
}

if the url is http://localhost/main.php?pid=sqlall or ?pid=sqlprof then
I want to case to assign. This is in conjuction with Smarty.
Any suggestion would be helpful.

Robert

Jul 17 '05 #1
8 3032
*** si*****@gmail.com escribió/wrote (7 Dec 2004 12:03:21 -0800):
I have a url that ends with ?pid=sqlall. I am using the following to
try and get at the "sqlall". I have read many sites to no avail.

switch ($_GET['pid']) {
case 'sqlall':


So, what's your problem? Have you done any sort of debugging, such us
printing the variables? Is that the URL of current page or some other you
have in a string?

--
-+ Álvaro G. Vicario - Burgos, Spain
+- http://www.demogracia.com (la web de humor barnizada para la intemperie)
++ Las dudas informáticas recibidas por correo irán directas a la papelera
-+ I'm not a free help desk, please don't e-mail me your questions
--
Jul 17 '05 #2

Alvaro G. Vicario wrote:
*** si*****@gmail.com escribió/wrote (7 Dec 2004 12:03:21 -0800):
I have a url that ends with ?pid=sqlall. I am using the following to try and get at the "sqlall". I have read many sites to no avail.

switch ($_GET['pid']) {
case 'sqlall':
So, what's your problem? Have you done any sort of debugging, such us
printing the variables? Is that the URL of current page or some other

you have in a string?

I have a "print_r" printing the $_GET. It IS displaying the right
string but my assign statements are not assigning anything. I am
calling the link from a JS using the following format:
"attu.php?pid=sqlall"

I am getting the "sqlall" it does not seem to be processing my assign->
parameters in the switch statement itself.

Robert

Jul 17 '05 #3
It seems to be the Smarty cache causing the problem. Because I am using
one page name "attu.php" the cache doesn't really see the change when I
do different assigns to it. I turned the Smarty cache off and bingo the
switch statement works.

Robert

Jul 17 '05 #4
On 8 Dec 2004 10:30:27 -0800, si*****@gmail.com wrote:
It seems to be the Smarty cache causing the problem. Because I am using
one page name "attu.php" the cache doesn't really see the change when I
do different assigns to it. I turned the Smarty cache off and bingo the
switch statement works.

It'd still be a bit better to do this:

$pid = $_GET['pid'];

switch ($pid) {
case 'sqlall':

....

--
gburnore@databasix dot com
---------------------------------------------------------------------------
How you look depends on where you go.
---------------------------------------------------------------------------
Gary L. Burnore | ÝÛ³ºÝ³Þ³ºÝ³³Ýۺݳ޳ºÝ³Ý³Þ³ºÝ³ÝÝÛ³
| ÝÛ³ºÝ³Þ³ºÝ³³Ýۺݳ޳ºÝ³Ý³Þ³ºÝ³ÝÝÛ³
DataBasix | ÝÛ³ºÝ³Þ³ºÝ³³Ýۺݳ޳ºÝ³Ý³Þ³ºÝ³ÝÝÛ³
| ÝÛ³ 3 4 1 4 2 ݳ޳ 6 9 0 6 9 ÝÛ³
Black Helicopter Repair Svcs Division | Official Proof of Purchase
================================================== =========================
Want one? GET one! http://signup.databasix.com
================================================== =========================
Jul 17 '05 #5
Gary L. Burnore <gb******@databasix.com> wrote:
It'd still be a bit better to do this:

$pid = $_GET['pid'];

switch ($pid) {
case 'sqlall':

...


Huh! Why?

Jul 17 '05 #6
si*****@gmail.com wrote:
It seems to be the Smarty cache causing the problem. Because I am using
one page name "attu.php" the cache doesn't really see the change when I
do different assigns to it. I turned the Smarty cache off and bingo the
switch statement works.


See the msarty manual how to have multiple caches for 1 page:
http://smarty.php.net/manual/en/cach...ple.caches.php

Jul 17 '05 #7
On 09 Dec 2004 19:12:20 GMT, Daniel Tryba <sp**@tryba.invalid> wrote:
Gary L. Burnore <gb******@databasix.com> wrote:
It'd still be a bit better to do this:

$pid = $_GET['pid'];

switch ($pid) {
case 'sqlall':

...


Huh! Why?


Moving the $_GET stuff in to their own variables is a good habit to
get into for more than one reason. One is less typing on re-use.
It's easier to type $pid more than once rather than typing
$_GET['pid'] more than once for example.

--
gburnore@databasix dot com
---------------------------------------------------------------------------
How you look depends on where you go.
---------------------------------------------------------------------------
Gary L. Burnore | ÝÛ³ºÝ³Þ³ºÝ³³Ýۺݳ޳ºÝ³Ý³Þ³ºÝ³ÝÝÛ³
| ÝÛ³ºÝ³Þ³ºÝ³³Ýۺݳ޳ºÝ³Ý³Þ³ºÝ³ÝÝÛ³
DataBasix | ÝÛ³ºÝ³Þ³ºÝ³³Ýۺݳ޳ºÝ³Ý³Þ³ºÝ³ÝÝÛ³
| ÝÛ³ 3 4 1 4 2 ݳ޳ 6 9 0 6 9 ÝÛ³
Black Helicopter Repair Svcs Division | Official Proof of Purchase
================================================== =========================
Want one? GET one! http://signup.databasix.com
================================================== =========================
Jul 17 '05 #8
Gary L. Burnore <gb******@databasix.com> wrote:
It'd still be a bit better to do this:

$pid = $_GET['pid'];

switch ($pid) {
case 'sqlall':

...


Huh! Why?


Moving the $_GET stuff in to their own variables is a good habit to
get into for more than one reason. One is less typing on re-use.
It's easier to type $pid more than once rather than typing
$_GET['pid'] more than once for example.


That must be the worst reason I ever heard! Offcourse varriables should
be to the point and descriptive. But that doens't mean shorter is
always better.

But $_GET['pid'] says something extra, like that it came from an
untrustworthy source. Making a raw copy hides that fact, so when $pid is
later used in output there is a chance that correctly escaping will be
forgotten.

Jul 17 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Dan | last post by:
I was trying to troubleshoot a login page that doesn't work - it keeps saying the login/password is missing - when my tracing discovered this peculiar behavior. register_globals is off, so at...
32
by: Nuno Paquete | last post by:
Hi group. I'm using this code to see if is there any parameter for variable "menu": if($_GET == "downloads") .... But this code log errors if there is no parameter passed (this heappens at...
1
by: Francisco Mendez | last post by:
I have the following problem: When i use "scooters" in the value of the radio as well as in the switch statement, the code doesn't get executed, but if i use "scooter" it does. Is there...
4
by: JaNE | last post by:
I'm trying to get some data from MySql database and to create switch based on those data, but as an php beginer, I have no clear idea how to do this. have tryed many options which loked promising,...
2
by: Angelos | last post by:
Ok... I have to make this administation area where I have multiple Contents to add edit delete publish . The problem is that I don't know what is the best way of making the forms. At the moment I...
4
by: Angelos | last post by:
Ok... I have to make this administation area where I have multiple Contents to add edit delete publish . The problem is that I don't know what is the best way of making the forms. At the moment I...
9
by: wouter | last post by:
hey hi..... I wanna make a switch wich does this: if pagid is set do A, if catid is set do B, if projectid is set do C, else do D. So i was thinking something like this:
2
by: keeps21 | last post by:
I have a script that recieves an id number via the address bar when a link is clicked. ie . index.php?id=1 if the link was for the story whose ID is 1. My script checks if a user is logged in,...
2
by: Annalyzer | last post by:
My form looks like this: <form action="handle_event.php" method="POST" enctype="multipart/form-data"> <table id="event_edit" border="0"> <tr> <td> ...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.