|
|
PHP on OSX
|
|
|
|
Forum Regular
Join Date: Apr 2000
Location: California
Status:
Offline
|
|
Hi all,
I just installed PHP on OSX, and am having issues getting PHP to process my url actions. For instance, the url:
http://localhost/~dude/test.php?action=uno
It should display a message saying "Page One", based on the code below. However, it always defaults to "No Action."
When I put the same code on my server, it processes my actions without problem. How can I configure my Mac to serve this correctly?
Thanks!
- Slim
The code from test.php
<?
if ($action == "uno") {
echo("Page One");
}
else if ($action == "dos") {
echo("Page Two");
}
else {
echo("No Action.");
}
?>
|
|
|
|
|
|
|
|
|
Grizzled Veteran
Join Date: Nov 2003
Location: Hebburn, UK
Status:
Offline
|
|
the variable $action doesn't exist because global variables are turned off by default. Try:
[php]
<?
$action = $_GET['action'];
if ($action == "uno") {
echo("Page One");
}
else if ($action == "dos") {
echo("Page Two");
}
else {
echo("No Action.");
}
?>
[/php]
|
Just who are Britain? What do they? Who is them? And why?
Formerly Black Book
|
|
|
|
|
|
|
|
Forum Regular
Join Date: Apr 2000
Location: California
Status:
Offline
|
|
Thank you so much, Black book...
I had no idea about the global variables being turned off for OSX, but have read about that in regards to security concerns. Anyway, it worked perfectly!
Cheers from California!
- Slim
|
|
|
|
|
|
|
|
|
Mac Elite
Join Date: Oct 1999
Location: San Jose, Ca
Status:
Offline
|
|
It is not just MacOS X... that is now the default for PHP.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Forum Rules
|
|
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
|
|
|
|
|
|