Well, the title's pretty self-explanatory. I have a form on an index.html.
And this PHP code to POST that form into an external URL and then redirect to the index again:
<?php
Echo "<style>body{background:#3e4744}</style>";
Echo "<style>h2{display:none}</style>";
//extract data from the post
//set POST variables
$url = 'https://blablabla.com';
$fields = array(
'email' => urlencode($_POST['email'])
);
//url-ify the data for the POST
foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; }
rtrim($fields_string, '&');
//open connection
$ch = curl_init();
//set the url, number of POST vars, POST data
curl_setopt($ch,CURLOPT_URL, $url);
curl_setopt($ch,CURLOPT_POST, count($fields));
curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string);
//execute post
$result = curl_exec($ch);
//close connection
curl_close($ch);
if (isset($_POST['submit'])){
?>
<script type="text/javascript">
window.location = "/";
</script>
<?php
}
?>
So, the thing is. How can I show an alert box saying something like: "Your post was succesfully sent" right after the page has been redirected?