我试图做一些特定的事情,而不是完全确定如何做到这一点。这就是我要做的事情......
我创建了一个HTML表单,用户在其中指定URL,然后输入验证码。表格的其余部分是隐藏的,并随提交一起发送。
成功提交后,表单将发送到本地处理程序PHP文件,该文件将信息显示给用户以供审阅,并使用另一个提交按钮。处理程序页面上的所有表单数据都是隐藏的,因为它已经被指定了。
第二次提交成功后,相关表单数据将添加到数据库中,并发送到安全的第三方付款表单。我控制的唯一代码是初始表格和确认表格。
form.html - 收集URL和Captcha,然后提交隐藏的表单值 form2.php - 从form.html中获取所有表单值,将其回显给用户进行查看。添加到数据库,并提交到外部表单。
我不完全确定如何使表单2正常工作。当显示表单2时,它不会在第二次提交时添加到数据库,而是在第一次提交时添加它。
以下是第二种形式:(请原谅凌乱的代码!)
<?php
session_start();
if( ($_SESSION['security_code2']==$_POST['security_code2']) && (!empty($_POST['security_code2'])) ) {
//Get user submitted data for review
$x_user1 = $_POST["domain"];
$x_login = $_POST["x_login"];
$x_show_form = $_POST["x_show_form"];
$x_fp_sequence = $_POST["x_fp_sequence"];
$x_fp_hash = $_POST["x_fp_hash"];
$x_amount = $_POST["x_amount"];
$x_currency_code = $_POST["x_currency_code"];
$x_test_request = $_POST["x_test_request"];
$x_relay_response = $_POST["x_relay_response"];
$donation_prompt = $_POST["donation_prompt"];
$x_line_item = $_POST["x_line_item"];
$button_code = $_POST["button_code"];
$x_show_form = $_POST["x_show_form"];
echo "<!DOCTYPE html>
<html>
<head>
<link rel=\"stylesheet\" type=\"text/css\" href=\"./css/redneck2.css\" />
<link rel=\"stylesheet\" type=\"text/css\" href=\"./css/payments.css\" />
<script>document.createElement(\"plist\")</script>
<script>document.createElement(\"phead\")</script>
<meta charset=\"UTF-8\">
<title>
Company Name - Confirm Selection
</title>
</head>
<body>
<!-- begin main menu -->
<nav>
<table id=\"menu1\">
<tr>
<td id=\"menu2\">
<a class=\"menutopleft\" href=\"index.html\">
Home
</a>
</td>
<td id=\"menu2\">
<a class=\"menutopright\" href=\"faq.html\">
F.A.Q.
</a>
</td>
</tr>
<tr>
<td id=\"menu2\">
<a class=\"menu3\" href=\"new.html\">
New
</a>
</td>
<td id=\"menu2\">
<a class=\"menu3\" href=\"soon.html\">
Soon
</a>
</td>
</tr>
<tr>
<td id=\"menu2\">
<a class=\"menu3\" href=\"terms.html\">
Terms
</a>
</td>
<td id=\"menu2\">
<a class=\"menu3\" href=\"privacy.html\">
Privacy
</a>
</td>
</tr>
<tr>
<td id=\"menu2\">
<a class=\"menu3\" href=\"hardware.html\">
Hardware
</a>
</td>
<td id=\"menu2\">
<a class=\"menu3\" href=\"tips.html\">
Tips
</a>
</td>
</tr>
<tr>
<td id=\"menu2\">
<a class=\"menu3\" href=\"alerts.html\">
Alerts
</a>
</td>
<td id=\"menu2\">
<a class=\"menu3\" href=\"payments.html\">
Payments
</a>
</td>
</tr>
<tr>
<td id=\"menu2\">
<a class=\"menu4\" href=\"packages.html\">
Packages
</a>
</td>
<td id=\"menu2\">
<a class=\"menu3\" href=\"status.html\">
Status
</a>
</td>
</tr>
<tr>
<td id=\"menu2\">
<a class=\"menu3\" href=\"testimonials.html\">
Testimonials
</a>
</td>
<td id=\"menu2\">
<a class=\"menu3\" href=\"thanks.html\">
Thanks
</a>
</td>
</tr>
<tr>
<td id=\"menu2\">
<a class=\"menu3\" href=\"aboutus.html\">
About Us
</a>
</td>
<td id=\"menu2\">
<a class=\"menu3\" href=\"./contactus/form.html\">
Contact Us
</a>
</td>
</tr>
<tr>
<td id=\"menu2\">
<a class=\"menu3\" href=\"tutorial.html\">
Tutorial
</a>
</td>
<td id=\"menublank\">
</td>
</tr>
<tr>
<td id=\"menublank\">
</td>
<td id=\"menublank\">
</td>
</tr>
</table>
<table id=\"menufooter\">
<tr>
<td>
<a href=\"index.html\">
Powered by Company name
</a>
</td>
</tr>
<tr>
<td>
Created by - creator
</td>
</tr>
</table>
</nav>
<!-- end main menu -->
<!-- begin header -->
<header>
<a href=\"index.html\">
<img src=\"./images/banner1.jpg\">
</a>
<h1>
Packages
</h1>
<!--begin page menu -->
<table id=\"pagemenu1\">
<tr>
<td id=\"pagemenu2\">
<a class=\"pagemenu4tl\" href=\"packages.html\">
Package 1
</a>
</td>
<td id=\"pagemenu2\">
<a class=\"pagemenu3\" href=\"packages2.html\">
Package 2
</a>
</td>
<td id=\"pagemenu2\">
<a class=\"pagemenu3\" href=\"packages3.html\">
Package 3
</a>
</td>
<td id=\"pagemenu2\">
<a class=\"pagemenu3\" href=\"packages4.html\">
Package 4
</a>
</td>
<td id=\"pagemenu2\">
<a class=\"pagemenu3\" href=\"packages5.html\">
Package 5
</a>
</td>
<td id=\"pagemenu2\">
<a class=\"pagemenu3tr\" href=\"packages6.html\">
Specialty
</a>
</td>
</tr>
<tr>
<td id=\"pagemenublankbl\">
</td>
<td id=\"pagemenublank\">
</td>
<td id=\"pagemenublank\">
</td>
<td id=\"pagemenublank\">
</td>
<td id=\"pagemenublank\">
</td>
<td id=\"pagemenublankbr\">
</td>
</tr>
</table>
<!-- end page menu -->
</header>
<!-- end header -->
<section>
Below is information about our packages.
<hr>
<h3>
Please confirm your selection below!
</h3>
<p>
Package information
</p>
<p>
Package information goes here
<!-- Display user submitted URL -->
submitted URL: " . $x_user1 . "<br/>
<!-- Add second form, and insert database information -->
<!-- Begin confirmation form -->
<form action=\"3rdparty_handler\" method=\"POST\">
<input name=\"x_user1\" type=\"hidden\" value=\"" . $x_user1 . "\">
<input name=\"x_login\" type=\"hidden\" value=\"" . $x_login . "\">
<input name=\"x_show_form\" type=\"hidden\" value=\"" . $x_show_form . "\">
<input name=\"x_fp_sequence\" type=\"hidden\" value=\"" . $x_fp_sequence . "\">
<input name=\"x_fp_hash\" type=\"hidden\" value=\"" . $x_fp_hash . "\">
<input name=\"x_amount\" type=\"hidden\" value=\"" . $x_amount . "\">
<input name=\"x_currency_code\" type=\"hidden\" value=\"" . $x_currency_code . "\">
<input name=\"x_test_request\" type=\"hidden\" value=\"" . $x_test_request . "\">
<input name=\"x_relay_response\" type=\"hidden\" value=\"" . $x_relay_response . "\">
<input name=\"donation_prompt\" type=\"hidden\" value=\"" . $donation_prompt . "\">
<input name=\"x_line_item\" type=\"hidden\" value=\"" . $x_line_item . "\">
<input name=\"button_code\" type=\"hidden\" value=\"" . $button_code . "\">
<input id=\"paynow3\" type=\"submit\" value=\"Confirm\">
<!-- End confirmation form -->
</p>
</section>
<!--Begin Footer -->
<footer>
<p>
<table id=\"pagefooter\">
<tr>
<td>
<a href=\"index.html\">
Powered by Company name
</a>
</td>
</tr>
<tr>
<td>
Created by creator
</td>
</tr>
</table>
</p>
</footer>
<!-- End Footer -->
</body>
</html>";
//Begin Customer number, and URL retrieval
//Specify database information
$servername = "localhost";
$dbuser = "dbuser";
$dbpassword = "dbpassword";
$dbname = "dbname";
//Create connection
$conn = new mysqli($servername, $dbuser, $dbpassword, $dbname);
// Check Connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
// Insert customer number, and package number in database
$sql = "INSERT INTO CustomerNumber (package,domain)
VALUES ('1','$x_user1')";
if ($conn->query($sql) === TRUE) {
$x_po_num = $conn->insert_id;
echo ('<input name="x_po_num" value="' . $x_po_num . '" type="hidden">' );
}
else {
echo "Error: " . $sql . "<br>" . $conn->error;
}
// Close connection
$conn->close();
//End customer number, and URL retrieval
}
else {
echo "<!DOCTYPE html>
<html>
<head>
<link rel=\"stylesheet\" type=\"text/css\" href=\"./css/redneck2.css\" />
<link rel=\"stylesheet\" type=\"text/css\" href=\"./css/payments.css\" />
<script>document.createElement(\"plist\")</script>
<script>document.createElement(\"phead\")</script>
<meta charset=\"UTF-8\">
<title>
Company name - Confirm Selection
</title>
</head>
<body>
<!-- begin main menu -->
<nav>
<table id=\"menu1\">
<tr>
<td id=\"menu2\">
<a class=\"menutopleft\" href=\"index.html\">
Home
</a>
</td>
<td id=\"menu2\">
<a class=\"menutopright\" href=\"faq.html\">
F.A.Q.
</a>
</td>
</tr>
<tr>
<td id=\"menu2\">
<a class=\"menu3\" href=\"new.html\">
New
</a>
</td>
<td id=\"menu2\">
<a class=\"menu3\" href=\"soon.html\">
Soon
</a>
</td>
</tr>
<tr>
<td id=\"menu2\">
<a class=\"menu3\" href=\"terms.html\">
Terms
</a>
</td>
<td id=\"menu2\">
<a class=\"menu3\" href=\"privacy.html\">
Privacy
</a>
</td>
</tr>
<tr>
<td id=\"menu2\">
<a class=\"menu3\" href=\"hardware.html\">
Hardware
</a>
</td>
<td id=\"menu2\">
<a class=\"menu3\" href=\"tips.html\">
Tips
</a>
</td>
</tr>
<tr>
<td id=\"menu2\">
<a class=\"menu3\" href=\"alerts.html\">
Alerts
</a>
</td>
<td id=\"menu2\">
<a class=\"menu3\" href=\"payments.html\">
Payments
</a>
</td>
</tr>
<tr>
<td id=\"menu2\">
<a class=\"menu4\" href=\"packages.html\">
Packages
</a>
</td>
<td id=\"menu2\">
<a class=\"menu3\" href=\"status.html\">
Status
</a>
</td>
</tr>
<tr>
<td id=\"menu2\">
<a class=\"menu3\" href=\"testimonials.html\">
Testimonials
</a>
</td>
<td id=\"menu2\">
<a class=\"menu3\" href=\"thanks.html\">
Thanks
</a>
</td>
</tr>
<tr>
<td id=\"menu2\">
<a class=\"menu3\" href=\"aboutus.html\">
About Us
</a>
</td>
<td id=\"menu2\">
<a class=\"menu3\" href=\"./contactus/form.html\">
Contact Us
</a>
</td>
</tr>
<tr>
<td id=\"menu2\">
<a class=\"menu3\" href=\"tutorial.html\">
Tutorial
</a>
</td>
<td id=\"menublank\">
</td>
</tr>
<tr>
<td id=\"menublank\">
</td>
<td id=\"menublank\">
</td>
</tr>
</table>
<table id=\"menufooter\">
<tr>
<td>
<a href=\"index.html\">
Powered by Company name
</a>
</td>
</tr>
<tr>
<td>
Created by creator
</td>
</tr>
</table>
</nav>
<!-- end main menu -->
<!-- begin header -->
<header>
<a href=\"index.html\">
<img src=\"./images/banner1.jpg\">
</a>
<h1>
Packages
</h1>
<!--begin page menu -->
<table id=\"pagemenu1\">
<tr>
<td id=\"pagemenu2\">
<a class=\"pagemenu4tl\" href=\"packages.html\">
Package 1
</a>
</td>
<td id=\"pagemenu2\">
<a class=\"pagemenu3\" href=\"packages2.html\">
Package 2
</a>
</td>
<td id=\"pagemenu2\">
<a class=\"pagemenu3\" href=\"packages3.html\">
Package 3
</a>
</td>
<td id=\"pagemenu2\">
<a class=\"pagemenu3\" href=\"packages4.html\">
Package 4
</a>
</td>
<td id=\"pagemenu2\">
<a class=\"pagemenu3\" href=\"packages5.html\">
Package 5
</a>
</td>
<td id=\"pagemenu2\">
<a class=\"pagemenu3tr\" href=\"packages6.html\">
Specialty
</a>
</td>
</tr>
<tr>
<td id=\"pagemenublankbl\">
</td>
<td id=\"pagemenublank\">
</td>
<td id=\"pagemenublank\">
</td>
<td id=\"pagemenublank\">
</td>
<td id=\"pagemenublank\">
</td>
<td id=\"pagemenublankbr\">
</td>
</tr>
</table>
<!-- end page menu -->
</header>
<!-- end header -->
<section>
Below is information about our available packages.
<hr>
<h3>
Invalid Security Captcha String!<br/>
Please use your browser's back button to go back, and try again.
</h3>
<p>
</p>
</section>
<!--Begin Footer -->
<footer>
<p>
<table id=\"pagefooter\">
<tr>
<td>
<a href=\"index.html\">
Powered by Company name
</a>
</td>
</tr>
<tr>
<td>
Created by creator
</td>
</tr>
</table>
</p>
</footer>
<!-- End Footer -->
</body>
</html>";
}
?>