I would like to check the query string within a page to see if the status variable has been passed and, if so, what it's value is.
Here's the full path: http://domain.com/page/?status=success
I would to know that "status" has indeed been passed and was a success. If it's just
http://domain.com/page
Then I know that there's not a status passed. There must be an incredibly easy way to do this; I'm simply not familiar with PHP. Can anyone help?
Thanks!
How to check the query string?
Re: How to check the query string?
taylort,
You can use the echo function in PHP. Just after you updated a table you could have the following:
This will display what the actual query was against the database. Take special care of the last part: die() as this stops your application immediatly.
Showing if a parameter has been passed. CMSMS normaly uses the $params to pass the parameters. This is an array of values. A nifty option is to use:
This will show the values of the array in a nice readable way.
Simple way could also be:
Duketown
You can use the echo function in PHP. Just after you updated a table you could have the following:
Code: Select all
echo "DEBUG: result = ".$db->ErrorMsg()."<br/> ".$db->sql."<br/>"; die();
Showing if a parameter has been passed. CMSMS normaly uses the $params to pass the parameters. This is an array of values. A nifty option is to use:
Code: Select all
debug_display($params);
Simple way could also be:
Code: Select all
echo ('Status parameter contains: '.$params['status']);
-
- Support Guru
- Posts: 8169
- Joined: Tue Oct 19, 2004 6:44 pm
- Location: Fernie British Columbia, Canada
Re: How to check the query string?
This is basic PHP stuff..... if the variable was passed by GET, the variable will be in $_GET. if the variable was passed by POST the value will be in $_POST. If you don't care which method the variable was passed by check $_REQUEST.taylort wrote: I would like to check the query string within a page to see if the status variable has been passed and, if so, what it's value is.
Here's the full path: http://domain.com/page/?status=success
I would to know that "status" has indeed been passed and was a success. If it's just
http://domain.com/page
Then I know that there's not a status passed. There must be an incredibly easy way to do this; I'm simply not familiar with PHP. Can anyone help?
Thanks!
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Re: How to check the query string?
This seems outrageously simple but I'm having more trouble than anything. Here's the very simple code that I've added to the top of one of my pages:
No matter what I pass in the query string it will display the "Please submit your information." I know it's likely something simple I need to change.
Any suggestions?
Code: Select all
{if $_REQUEST['status'] eq 'success'}
Thank you for submitting your information!
{else}
Please submit your information.
{/if}
Any suggestions?
-
- Support Guru
- Posts: 8169
- Joined: Tue Oct 19, 2004 6:44 pm
- Location: Fernie British Columbia, Canada
Re: How to check the query string?
You can't mix smarty and php variables in that way.
try: {if isset($smarty.request.status) && $smarty.request.status eq 'success')}
try: {if isset($smarty.request.status) && $smarty.request.status eq 'success')}
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Re: How to check the query string?
You are the man! That fixed it - thanks so much for the help everyone.calguy1000 wrote: You can't mix smarty and php variables in that way.
try: {if isset($smarty.request.status) && $smarty.request.status eq 'success')}
Re: How to check the query string?
Hello,
feel free to add it in the wiki. You can contribute with your forum account.
Happy new year
Pierre M.
feel free to add it in the wiki. You can contribute with your forum account.
Happy new year
Pierre M.