/    Sign up×
Community /Pin to ProfileBookmark

php urgent help.

hi to all!

how to links php pages with select statement. is it the right way. if yes?

then why it is not working with links in php.

<?php
//selector.php
switch ($action)
{
case “order_food”:
include “hotel.php”;
break;
case “play_hangman”:
include “play.php”;
break;
default:
echo “Please choose what you’d like to do:<BR>”;
echo “<A HREF=<?php action=order_food>Order Food</A><BR>”;
echo “<A HREF=?action=play_hangman>Play</A>”;
}
?>

it display the error message like variable $option not declared.

thanx for any response. . .

to post a comment
PHP

6 Comments(s)

Copy linkTweet thisAlerts:
@BeachSideJul 15.2005 — What line are you getting the error on because you don't have a variable named [B]$option[/B] in the code you provided?

Also you have errors in the code you did provide...
[code=php]
<?php
//selector.php
switch ($action) {
case "order_food":
include "hotel.php";
break;
case "play_hangman":
include "play.php";
break;
default:
echo "Please choose what you'd like to do:<BR>";
echo "<A HREF="YOU NEED A LINK IN HERE?action=order_food">Order Food</A><BR>";
echo "<A HREF="YOU NEED A LINK IN HERE TOO?action=play_hangman">Play</A>";
}
?>
[/code]
Copy linkTweet thisAlerts:
@mahfoozauthorJul 15.2005 — ok

thanx for response

but here is a problem . i don't under stand the use of " select " statement in this code. that is not my code but a weox book code.

if we simply write these lines, it will work as they did in "select" statement.


[SIZE=1]echo "<A HREF="YOU NEED A LINK IN HERE?action=order_food">Order Food</A><BR>";

echo "<A HREF="YOU NEED A LINK IN HERE TOO?action=play_hangman">Play</A>";[/SIZE]



let u tell me where we need to use "select" statement with links.

i want to display hotels on the "result.php" page by searching from database.

don't be worry about database, i will handle it any way.

only PHP with select "statement"

thannx once again for response.
Copy linkTweet thisAlerts:
@SpectreReturnsJul 16.2005 — <?php

//selector.php

switch ($action) {

case "order_food": include "hotel.php"; break;

case "play_hangman": include "play.php"; break;

default:

echo "Please choose what you'd like to do:<BR>";

echo "<A HREF='?action=order_food'>Order Food</A><BR>";

echo "<A HREF='?action=play_hangman'>Play</A>";

[b]break;[/b]

}

?>

It's bad coding practice not to use "" or '' in html. I dont know WHY you had <?php inside the echo, but I suspect that is what was causing the error.

Oh, and BeachSide, you don't need a link before ?, if not it acts as passing a query to the index of the directory (like if you remove the index.php).
Copy linkTweet thisAlerts:
@BeachSideJul 16.2005 — Oh, and BeachSide, you don't need a link before ?, if not it acts as passing a query to the index of the directory (like if you remove the index.php).[/QUOTE]
True.

Chalk it up to habit I guess, I don't like taking too many shortcuts like that. It tends to lead to errors for me, not to mention the loss of hair from finding those errors, and I like my hair :p

Kinda like ternary operators, I cannot stand using things like ? and : instead of if/else looking for those makes me :eek: lol
Copy linkTweet thisAlerts:
@SpectreReturnsJul 16.2005 — I like those. ?

OH, and sorry for hijacking the thread.
Copy linkTweet thisAlerts:
@mahfoozauthorJul 16.2005 — salam to all!


i have 15 result from querying database, here i want to display only 10 result per page, next 5 result would displayed on the next page. what should i do now

thanx. . .
×

Success!

Help @mahfooz spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.20,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...