Please somehelp me to correct my code so that after the user click the submit button it redirects to the correct URL if the value is correct. I get the error when pressing submit this php file will be displayed in an iframe for wordpress site or if it is standalone page it redirects correctly after clicking submit but does not oen the form correctly.
Error
Warning: Cannot modify header information - headers already sent by
<?php
function test_input($data) {
$data = trim($data);
$data = stripslashes($data);
$data = htmlspecialchars($data);
return $data;
}
$amountErr = "";
$amount = "";
if ($_SERVER["REQUEST_METHOD"] == "POST") {
if (($_POST["amount"]) < 250) {
$amountErr = "Value must be equal or greater than 250";
} else {
$amount = test_input($_POST["amount"]);
header('location:https://www.moneybookers.com/app/payment.pl');
}
}
?>
<form method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]); ?>"
<p><span class="error">*required field.</span></p>
Amount:<input type="text" name="amount"/>
<span class="error">*<?php echo $amountErr; ?></span><bR>
<input type="hidden" name="pay_to_email" value="someone.com"/>
<input type="hidden" name="status_url" value="someone.com"/>
<input type="hidden" name="return_url" value="http://wwww.somesite.com"/>
<input type="hidden" name="language" value="EN"/>
<input type="hidden" name="currency" value="USD"/>
<input type="hidden" name="detail1_description" value="New Deposit"/>
<input type="hidden" name="detail1_text" value="New Deposit"/><BR>
<input type="submit" value="Deposit!"/>