简体   繁体   English

为什么我的“提交”按钮在此代码中不起作用?

[英]Why doesn't my submit button work in this code?

I'm making a PayPal checkout form. 我正在制作PayPal结帐表格。 On one page, it works really well. 在一页上,它确实运行良好。 It takes the infomration and opens PayPal when submitted without any issues. 提交信息并在提交时没有任何问题时打开PayPal。 However, I placed this code on another page, and it doesn't work. 但是,我将此代码放在了另一页上,并且不起作用。 When I click the button, nothing happens. 当我单击按钮时,什么也没有发生。 The code is the same! 代码是一样的! I even copied the page, and it doesn't work on the copied version. 我什至复制了页面,但在复制的版本上不起作用。

Do you know why? 你知道为什么吗? I'm stumped! 我很沮丧!

Here's my code (please note I used "xxxx" in place of personal information): 这是我的代码(请注意,我使用“ xxxx”代替了个人信息):

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>

<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="paypal"><input name="cmd" type="hidden" value="_cart" />
<input name="business" type="hidden" value="xxxx" />
<input name="item_name" type="hidden" value="xxxx" />
<input name="item_number" type="hidden" value="xxxx" /></form>
<table>

<tbody>
<tr>
<td>Name of Attendee(s)</td>
<td><input name="on1" type="hidden" value="Name of Attendee(s)" />
<input maxlength="200" name="os1" type="text" /></td>
</tr>
<tr>
<td>Ticket Type</td>
<td><input name="on0" type="hidden" value="Ticket Type" />
<select name="os0">
<option value="Single Ticket">Single Ticket - $50.00</option>
<option value="Double Ticket">Double Ticket - $100.00</option>
</select>
<!-- Specify the price that PayPal uses for each option. -->
<input name="option_index" type="hidden" value="0" />
<input name="option_select0" type="hidden" value="Single Ticket" />
<input name="option_amount0" type="hidden" value="50.00" />
<input name="option_select1" type="hidden" value="Double Ticket" />
<input name="option_amount1" type="hidden" value="100.00" /></td>
</tr>
<tr>
<td></td>
<td><input alt="PayPal The safer, easier way to pay online." name="submit" src="images/btn_cart_LG.gif" type="submit" value="Continue to PayPal" /></td>
</tr>
</tbody>
</table>
<input name="image_url" type="hidden" value="" />
<input name="return" type="hidden" value="xxxx" />
<input name="cancel_return" type="hidden" value="xxxx" />
<input name="cn" type="hidden" value="optional instructions" />
<input name="currency_code" type="hidden" value="USD" />
<input name="no_note" type="hidden" value="1" />
<img style="display: none ! important;" hidden="" src="https://www.paypalobjects.com/en_GB/i/scr/pixel.gif" alt="" width="1"         height="1" border="0" />
<input name="add" type="hidden" value="1" />

</form>

</body>
</html>

This line here: 这行在这里:

<input name="item_number" type="hidden" value="xxxx" /></form>

You closed the form tag before you wanted to, just remove this tag and it works fine. 您在想要关闭表单标签之前就关闭了它,只需删除该标签即可,它可以正常工作。

Test case: https://jsfiddle.net/1hj4v81p/ 测试用例: https : //jsfiddle.net/1hj4v81p/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM