Greetings
I'm trying to interface with authorize.net and I've got it all done except for the last part.
I've successfully created a test purchase and received confirmation that it went through, and now I want to send the user the home page of my site using PHP.
But when I put in the code header("location: test_home.htm"); I get the error message that apparently a lot of other people get "Header already sent, cannot be modified."
I've tried inserting the code almost everywhere I can (every way but sideways) but no luck.
Below is the abridged version of the code I'm using
Help!
<html>
<head>
<title>Subject sign up form</title>
</head>
<body>
<form action="060_signup_form.php" method="post">
<table>
<tr>
<td>
<p>
<input type="hidden" name="check" value="1">
</p>
</td>
<td>
<p>
<input type="text" name="card_number">
</p>
</td>
</tr>
<tr>
<td>
<p>
<?php
if ($_POST["check"] != "1")
{}//do nothing
else
{
$post_url = "authorize URL";
$post_values = array ("x_card_num" => "$_POST[card_number]");
$post_string = "";
foreach( $post_values as $key => $value )
{
$post_string .= "$key=" . urlencode( $value ) . "&";
}
$post_string = rtrim( $post_string, "& " );
$request = curl_init($post_url);
curl_setopt($request, CURLOPT_HEADER, 0);
curl_setopt($request, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($request, CURLOPT_POSTFIELDS, $post_string);
curl_setopt($request, CURLOPT_SSL_VERIFYPEER, FALSE);
$post_response = curl_exec($request);
curl_close ($request);
$response_array = explode($post_values["x_delim_char"],$post_response);
// ****************************************************************************
// response array 3 is where the error messages are placed.
// They include "Incorrect credit card number." and "Incorrect expiration date."
// If there are no errors then the message in response array 3 reads "This transaction has been approved."
if($response_array[3]=="This transaction has been approved.")
{
header("location: test_home.htm");
}
// ****************************************************************************
echo
$response_array[3];
}
?>
</p>
</td>
</tr>
</table>
</form>
</body>
</html>