Here is an extract of coding from my "main.php"

if ($_GET["action"]==1){
//Redirected from the login page
}
else if ($_GET["action"]==2){
//Redirected from other page
}
else if ($_GET["action"]==3){
//Redirected from other page
}
else if ($_GET["action"]==4){
print "Test";
}
else if ($_GET["action"]==5){
print "Test2";
}
<a href = "?action=4>Action 4</a>
<a href = "?action=5>Action 5</a>

Action 4 and Action 5 are hyperlinks that exists in main.php, however, when I press either one, nothing happened. The main.php just simply refreshed and did not print out the "Test" text.
However, action 1,2 and 3 work.

I'd like to know what's wrong with this?
Thanks for your kindly help!:icon_cheesygrin:

Recommended Answers

All 3 Replies

Other than the unclosed double-quotes in the <a> tags, I don't see anything too terribly wrong, though it may be bad form to have spaces around the "=" in the anchor tags.

Other than the unclosed double-quotes in the <a> tags, I don't see anything too terribly wrong, though it may be bad form to have spaces around the "=" in the anchor tags.

thx for answering!

will it be a session problem?
coz I use the session_start() function at the very beginning.

Finally I figure out the problem.
The single quote in the <a href> tag make things bad.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.