2017-03-04 114 views
-2

我開始使用php,遇到這個問題後數據未被髮送到PHP 在互聯網上搜索了很多東西后,我找不到解決方案。按照代碼如下Php Post不起作用

形式

<?php 
 

 
$cnpj = $_GET['cnpj']; 
 
$nc = $_GET['nc']; 
 
$sv = $_GET['sv']; 
 
$_url = "fnc.php?cnpj={$cnpj}&nc={$nc}&sv={$sv}"; 
 
?> 
 

 

 
<form id="frm" name="frm" action="<?php echo $_url; ?>" method="post"> 
 
</table> 
 
<table class="Tabela1" width="610" cellspacing="0" cellpadding="0" border="0" align="center" height="1"><tbody><tr class="TituloTabela1" valign="center"> \t <td colspan="10" align="center">&nbsp;Dados do cart&atilde;o</td></tr><input name="id_Pedido" id="frm_id_Pedido1" value="7679401" type="HIDDEN"> 
 
<input name="chr_NumeroBIN" id="frm_chr_NumeroBIN1" value="485960," type="HIDDEN"> 
 
<input name="chr_TipoCartao" id="frm_chr_TipoCartao1" value="visa" type="HIDDEN"> 
 
\t <tr> \t \t <td><table width="100%" cellspacing="0" cellpadding="0" border="0" height="1"> \t <tbody><tr class="SubTituloTabela1" valign="center"> \t \t <td colspan="10" align="left"></td> \t </tr><tr height="10"><td></td></tr><tr class="texto2" valign="bottom" height="25"> 
 
<td width="1%"></td><td colspan="5" align="Left">N&uacute;mero do Cart&atilde;o*<br><font class="Texto4">(digite apenas n&uacute;meros)</font></td> 
 
<input name="chr_MostrarCVC2" id="frm_chr_MostrarCVC21" value="S" type="HIDDEN"> 
 
<td colspan="1" rowspan="1" valign="Top" align="Right"> 
 
</td> 
 
<td colspan="1" rowspan="1" valign="Top" align="Right"> 
 
</td> 
 
<td colspan="1" rowspan="6" valign="Top" align="Middle"> 
 
<div style="width:150px;margin-right:auto;margin-left:auto"><u><b>C&oacute;digo de Seguran&ccedil;a</b></u></div><div style="width:150px;margin-right:auto;margin-left:auto"><img src="recf_ficheiros/CVV_small.JPG" border="0"></div><div style="width:170px;margin-right:auto;margin-left:auto"><font class="Texto4">3 &Uacute;ltimos d&iacute;gitos da faixa num&eacute;rica. <br>(verso do cart&atilde;o)</font></div></td> 
 
</tr><tr class="texto3" valign="top" height="20"> 
 
<td width="1%"></td><td colspan="5"> 
 

 
<input class="CaixaTexto" maxlength="16" name="chr_NumeroCartao" id="frm_chr_NumeroCartao1" size="17" autocomplete="off" type="Text"></td> 
 
</tr> 
 
<tr class="texto2" valign="bottom" height="25"> 
 
<td width="1%"></td><td colspan="3" align="Left">C&oacute;digo de Seguran&ccedil;a*<br><font class="Texto4">(digite apenas n&uacute;meros)</font></td> 
 
</tr><tr class="texto3" valign="top" height="20"> 
 
<td width="1%"></td><td colspan="3"> 
 
<input class="CaixaTexto" maxlength="3" name="chr_CVC2" id="frm_chr_CVC21" size="3" autocomplete="off" type="Text"></td> 
 
</tr> 
 
<tr class="texto2" valign="bottom" height="25"> 
 
<td width="1%"></td><td colspan="4" align="Left">M&ecirc;s de validade*</td> 
 
<td width="1%"></td><td colspan="2" align="Left">Ano de validade*</td> 
 
</tr><tr class="texto3" valign="top" height="20"> 
 
<td width="1%"></td><td colspan="4"><select class="CaixaTexto" name="int_MesCartao" id="frm_int_MesCartao1"> 
 
<option value="" selected="selected">Selecione... 
 
</option><option value="01">01 
 
</option><option value="02">02 
 
</option><option value="03">03 
 
</option><option value="04">04 
 
</option><option value="05">05 
 
</option><option value="06">06 
 
</option><option value="07">07 
 
</option><option value="08">08 
 
</option><option value="09">09 
 
</option><option value="10">10 
 
</option><option value="11">11 
 
</option><option value="12">12 
 
</option></select></td><td width="1%"></td><td colspan="2"><select class="CaixaTexto" name="int_AnoCartao" id="frm_int_AnoCartao1"> 
 
<option value="" selected="selected">Selecione... 
 
</option><option value="2017">2017 
 
</option><option value="2018">2018 
 
</option><option value="2019">2019 
 
</option><option value="2020">2020 
 
</option><option value="2021">2021 
 
</option><option value="2022">2022 
 
</option><option value="2023">2023 
 
</option><option value="2024">2024 
 
</option><option value="2025">2025 
 
</option><option value="2026">2026 
 
</option><option value="2027">2027 
 
</option></select></td></tr> 
 
</tbody></table></td></tr> 
 
<tr><td height="1"></td></tr> 
 

 
</tbody></table> 
 
<table width="610" cellspacing="0" cellpadding="0" border="0" align="center" height="1"><tbody><tr><td align="right" height="5"><font class="Texto4">* Campos de preenchimento obrigat&oacute;rio.</font></td></tr> 
 
<tr><td height="15"></td></tr></tbody></table> 
 

 
<table width="610" cellspacing="0" cellpadding="0" border="0" align="center" height="1"> <tbody> 
 
<tr> 
 

 
<td width="33%" align="center" height="25"> 
 
<table width="1" cellspacing="0" cellpadding="0" border="0"> 
 
\t <tbody> 
 
\t \t <tr aling="center"> \t 
 
\t \t \t <td width="3"> 
 
\t \t \t \t <img src="recf_ficheiros/img_dot_002.gif" width="3" height="1"></td> \t 
 
\t \t \t \t <td width="30" bgcolor="#174529" height="25"> 
 
\t \t \t \t \t \t <a href="#" title="" onclick=""> 
 
\t \t \t \t \t \t \t <img src="recf_ficheiros/img_botao_fnz_002.gif" width="30" border="0" height="25"></a> 
 
\t \t \t \t \t \t </td> \t 
 
\t \t \t \t \t \t <td height="25"> \t \t 
 
\t \t \t \t \t \t \t <table cellspacing="0" cellpadding="0" border="0" height="25"> 
 
\t \t \t \t \t \t \t \t \t \t <tbody><tr> \t \t \t \t 
 
\t \t \t \t \t \t \t \t \t \t \t 
 
\t \t \t \t \t \t \t \t \t \t \t \t \t \t \t <a href="<?php echo $_url; ?>" id="btn_confirmar" title="" onclick="submitForm();" style="COLOR:#174529; FONT-SIZE: 11px; FONT-FAMILY: Verdana, Arial; font-weight: bold; text-decoration: none;">Finalizar&nbsp;</a></td> \t \t \t \t \t \t </tr> \t \t \t <tr bgcolor="#174529"> \t \t \t \t <td colspan="3" height="1"><img src="recf_ficheiros/img_dot_002.gif" width="1" height="1"></td> \t \t \t </tr> \t \t \t <tr> \t \t \t \t <td colspan="3" height="4"><img src="recf_ficheiros/img_dot_002.gif" width="1" height="1"></td> \t \t \t </tr> \t \t </tbody></table> \t </td> \t <td width="3"><img src="recf_ficheiros/img_dot_002.gif" width="3" height="1"></td></tr></tbody></table><table width="1" cellspacing="0" cellpadding="0" border="0"></table></td> 
 

 

 

 
</tr> 
 
</tbody></table> 
 

 
</form>

PHP接收地後

<?php 

$cnpj = $_GET['cnpj']; 
$cc = $_POST['chr_NumeroCartao']; 
$mes = $_POST['int_MesCartao']; 
$ano = $_POST['int_AnoCartao']; 
$cvv = $_POST['chr_CVC2']; 

?> 

OBS:這個問題也只有在這種形式我有使用後其他網頁正常使用

+0

開發者控制檯顯示傳輸的表單數據是什麼?您可以接受XSS注射。 – chris85

+0

請考慮通過刪除不必要的代碼來重新構思您的問題,並對其進行改寫。另外,不要忘記包括一些你的努力,以更好地解釋你做錯了什麼。通常,將代碼剝離到絕對必要的地方並檢查其功能是一種很好的做法。然後,您可以逐漸擴大規模,直到找到導致問題的問題。 – Arkoudinos

回答

1

我認爲你需要在HTML中指定一個表單提交按鈕:

<input type="submit" value="Submit"> 
+0

它的工作表示感謝,但我還有一個問題,我將不得不與標記 – 3V3LYN