Jump to content

$_REQUEST['URL'] not working .. ??


spacepoet

Recommended Posts

Hi:

 

Can anyone tell me why the following is not working:

 

a_Photo_Delete.php

<?php


$photo_id = $_REQUEST['photo_id'];

mysql_query("DELETE FROM gallery_photos WHERE photo_id = $photo_id");

header("Location: a_Photo_Edit.php");

?>


<!DOCTYPE HTML>

<html>
<head>

<meta charset="ISO-8859-1" />

<title></title>



</head>

<body>


</body>
</html>

------------------------------


a_Photo_Edit.php

<p>

<?php
if ($_REQUEST['URL'] == 'a_Photo_Delete.php') {
echo "<span class=\"textError\">Photo successfully deleted!</span>";
}
?>			

</p>

 

The photo gets deleted OK, and the HEADER goes to the "a_Photo_Edit.php" page properly, but the "Photo successfully deleted!" message does not show up ..

 

Confused why ..

 

??

Link to comment
Share on other sites

No, the location in the header goes to a different URL.

 

The reason the message isn't showing up is that you're not passing any value via the URL, so there's nothing in the $_REQUEST['URL'].  You probable want to use $_SERVER['HTTP_REFERER'].

 

Echo it first to see what it is. Or put a value on the URL in the header:

<?php
header("Location: a_Photo_Edit.php?URL=a_Photo_Delete.php");
exit();
?>

 

Ken

Link to comment
Share on other sites

Hi, I tried it like this:

 

<p>

<?php
if ($_SERVER['HTTP_REFERER'] == 'a_Photo_Delete.php') {
echo "<span class=\"textError\">Photo successfully deleted!</span>";
}
?>			

</p>

 

but it still doesn't work.

 

I'm stumped because I took the code from another site, and it works fine on that one.

 

Odd .. any other ideas?

 

Thanks.

Link to comment
Share on other sites

I do know the other site has a QueryString, so maybe that's why it worked?

<?php

$photo_id = $_REQUEST['photo_id'];

mysql_query("DELETE FROM gallery_photos WHERE photo_id = $photo_id");

header("Location: a_Page.php?myID=1");

?>

 

So, it will not work the way I have it?

 

Thanks for the help.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.