I have a need to submit form with specific values by clicking submit button. When clicking submit button I want to be redirected to PayPal where asked for donation. After submitting donation I need to redirect customer back to my website where form with values are submitted and shown to customer. But right now I`m stuck. If I press submit button after paying or canceling donation nothing happens with entered values in my primary form with title and website. My Code looks like this:
<form action="adding.php" method="post" enctype='multipart/form-data'>
<table>
<tr>
<td class="abc">
<p id="insert">Title:*</p><br>
<input type="text" name="title" class="abcd" value="<?php echo $title; ?>" />
</td>
<td class="abc">
<p id="insert">Website:*</p><br>
<input type="text" name="website" class="abcd" value="<?php echo $website; ?>" />
</td>
</tr>
</table>
<input type="submit" value="Submit" id="submit" name="submit" />
</form>
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="EJJ5RT9MEEJSC">
<input type="image" src="http://localhost/www/images/submit.png" id="submit" name="submit" border="0" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>
<?php
$sql2 = "INSERT INTO `www` (title, website)
VALUES ('$title', '$website')";
?>
<?php
if (isset($_POST['submit'])) {
$con = mysql_connect("localhost","root","");
if (!$con){
exit("Can not connect: " . mysql_error());
}
mysql_select_db("www",$con);
?>
<?php
if ((strlen($title) < 3) or (strlen($title) > 15)) {
echo "<h1 id='top'>Title must be between 3 and 15 characters long!</h1>";
} else if (filter_var($website, FILTER_VALIDATE_URL) === false) {
echo("<h1 id='top'>Website: Please enter a valid website to your wish.</h1>");
}
else
{
mysql_query($sql2,$con);
mysql_close($con);
header("Location:index.php");
}
?>