Jump to content

$_POST and header()


robert_gsfame

Recommended Posts

How can i pass the value $_POST after executing a query

and redirect it using header()

 

Assume:

<?php

 

$id=$_POST['id'];

 

$deletequery=mysql_query(sprintf("DELETE FROM table1 WHERE id='%s'",

mysql_real_escape_string($id)));

 

if($deletequery)

{

  header("Location:index.php");

}

 

?>

 

is it possible to get the $_POST['id'] value in  index.php

 

thx

 

Link to comment
https://forums.phpfreaks.com/topic/205614-_post-and-header/
Share on other sites

Why would a hidden form tag work on a redirect?  I don't understand that.

 

I can see using a header redirect and passing along information like:

header("Location:index.php?ID=<value>");

 

But without someone clicking on a submit button, how would this post?

Link to comment
https://forums.phpfreaks.com/topic/205614-_post-and-header/#findComment-1075976
Share on other sites

Why would a hidden form tag work on a redirect?  I don't understand that.

 

I can see using a header redirect and passing along information like:

header("Location:index.php?ID=<value>");

 

But without someone clicking on a submit button, how would this post?

 

Yeah he's right... It won't work my bad

 

You need to use Cookies, Session or $_GET['']

 

good luck!

Link to comment
https://forums.phpfreaks.com/topic/205614-_post-and-header/#findComment-1075978
Share on other sites

Archived

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

×
×
  • 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.