Jump to content

Archived

This topic is now archived and is closed to further replies.

Canman2005

If action

Recommended Posts

Hi all

Has anyone ever run into problems using the action query such as

[code]if ($action == "delete" && $id != "")
{[/code]

For some reason the web server I am using doesnt understand what the action is and simply ignores it, executing the first sql statement it can find on the page.

Any ideas would be great.

Thanks

Ed

Share this post


Link to post
Share on other sites
Where are you getting the value of $action from?

Share this post


Link to post
Share on other sites
[!--quoteo(post=352251:date=Mar 6 2006, 09:52 PM:name=Gaia)--][div class=\'quotetop\']QUOTE(Gaia @ Mar 6 2006, 09:52 PM) [snapback]352251[/snapback][/div][div class=\'quotemain\'][!--quotec--]
Where are you getting the value of $action from?
[/quote]


Via the form, so the form action might look like

<form id="form" method="post" action="page.php?action=delete">

Share this post


Link to post
Share on other sites
You'll still have to store the value into the variable.

[code]
$action = $_GET['action'];
[/code]

Share this post


Link to post
Share on other sites
For this case you would need to use "$_POST['action']"

This has all of the standard problems that indicate that this is a gregister_globals enabled vs. disabled problem.

You should always program your scripts assuming that [a href=\"http://www.php.net/register_globals\" target=\"_blank\"]register_globals[/a] is disabled.

Ken

Share this post


Link to post
Share on other sites
Are you sure?

page.php?action=delete is the form action, meaning it will go to that url correct?

So, wouldn't you just have to check if ?action=delete is attached to the URL?

Share this post


Link to post
Share on other sites
Sorry, my mistake -- I saw the action="Post" not the hard coded URL in the action. Yes, $_GET is correct.

Ken

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.