Hi Guys,
After many hours research I still can’t get my head around redirecting with header(location) and so am hoping someone out there would be kind enough to help me out?
Basically i am posting form results to a url and waiting for a response. If the response is yes then i would like to redirect the user to a url that was sent back with the response, otherwise the results are posted to a 2nd url and if the response from that is yes i would like to redirect the user to a url that was sent back with that response etc… etc…
<body>
<?php
if(isset($_POST['submit'])){
$email = $_POST['email'];
$title = $_POST['title'];
$first_name = $_POST['first_name'];
$last_name = $_POST['last_name'];
$ip = $_SERVER['REMOTE_ADDR'];
$id = $_SESSION['id'];
$date = date("Y-m-d");
$time = date("H:i:s");
//DO CURL STUFF
if ($response == "true"){
$xml = new SimpleXMLElement($leadResult);
$url = $xml->Redirect;
header("Location: $url"); // if i get a positive response i want to redirect
}
else {
//DO MORE CURL STUFF
if ($response == "true") {
$xml = new SimpleXMLElement($leadResult);
$url = $xml->Redirect;
header("Location: $url"); // if i get a positive response i want to redirect
}
else {
($response == "false");
}
}
// WRITE RESULTS TO DATABASE
}
?>
</body>
I realise that this won’t work, i’m just not sure why it won’t work and, more importantly, how to make it work.
Thanks in advance.