你好
1. 我想问下面代码中switch($product_id) 这里product_id与<input type="radio" name="product_id" id="product_id" 代码中的product_id是否是同一个
2.我想按照switch语句,当用户选择不同的产品时,根据product_id的value来传相对应的charge,就是product_id与charge按照下面代码中的函数处理,就是拼成串之后用加密工具进行加密,然后传过去,但我用echo $EncodingTxt;exit; 这个语句却不能显示 EncodingTxt的值,难道是函数处理过程中出了问题还是switch中的$product_id 与下面的<input type="radio" name="product_id" id="product_id" 这里的product_id不一样导致不输出。
<?php
switch($product_id){
case '20302000':
$charge = 1800;
break;
case '20301000':
$charge = 1000;
break;
}
$EncodingTxt = calling($product_id,$charge);
function calling($product_id,$charge) {
$EncodingValue = "";
$EncodingValue = "product_id=". $product_id .";charge=". $charge;
$EncodingTxt = Encoding($EncodingValue);
return $EncodingTxt;
}
function Encoding($EncodingValue){
$cmd = sprintf("jiami.exe W E \"%s\" ", $EncodingValue);
$EncodingTxt = exec($cmd);
return $EncodingTxt;
}echo $EncodingTxt;exit;
?>
<html>
<head>
<title>***</title>
<script type="text/javascript">
function testCount(){
var count1 = document.getElementById("txt_account").value;
var count2 = document.getElementById("txt_raccount").value;
if(count1!=count2){
alert("输入的账号不一致,请重新输入");
}else{
with(document.getElementById("form1")){
method="post";
action="http://***/abs.asp";
submit();
}
}
}
</script>
</head>
<body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0" onLoad="document.requestfrm.telnumber2.focus();SelCountry(document.requestfrm.area);">
<form id="form1">
<table width="374" height="415" border="0" align="center" cellpadding="0" cellspacing="1" style="border:1px solid #000000;">
<tr>
<td width="35%" align="center" height="50" valign="center"><font size="2.5px" color="#008000">* 充值金额</font></td>
<td width="65%" valign="bottom" height="50"><label>
<input type="radio" name="product_id" id="product_id" value="20302000" checked /><font size="2.5px">网易一卡通18元100点(18元)</font></label>
<br />
<label>
<input type="radio" name="product_id" id="product_id" value="20301000" />网易一卡通10元60点</label>
<br /><label> </td>
</tr>
<tr>
<td width="35%" align="center" height="50"><font size="2.5px" color="#008000"> * 需要充值的账户</font> </td>
<td width="65%" align="center" height="50"> <input name="txt_account" id="txt_account" size="25" value="" /> </td>
</tr>
<tr> <td align="center"><font size="2.5px" color="#008000">* 重复输入账户</font> </td>
<td align="center"> <input name="txt_raccount" id="txt_raccount" size="25" value="" onpaste='return false' oncontextmenu='return fasle'
onkeypress="return!(event.ctrlKey&&(String.fromCharCode(event.charCode=='v')))"/> </font> </td>
</tr>
<tr>
<td height="50" colspan="2" align="center">
<input type="button" name="sb_next" class="paysubmit" value="发送" onclick='testCount()' /> </td>
<INPUT TYPE="hidden" NAME="request" VALUE="<? echo($EncodingTxt) ?>">
</tr>
</table>
1. 我想问下面代码中switch($product_id) 这里product_id与<input type="radio" name="product_id" id="product_id" 代码中的product_id是否是同一个
2.我想按照switch语句,当用户选择不同的产品时,根据product_id的value来传相对应的charge,就是product_id与charge按照下面代码中的函数处理,就是拼成串之后用加密工具进行加密,然后传过去,但我用echo $EncodingTxt;exit; 这个语句却不能显示 EncodingTxt的值,难道是函数处理过程中出了问题还是switch中的$product_id 与下面的<input type="radio" name="product_id" id="product_id" 这里的product_id不一样导致不输出。
<?php
switch($product_id){
case '20302000':
$charge = 1800;
break;
case '20301000':
$charge = 1000;
break;
}
$EncodingTxt = calling($product_id,$charge);
function calling($product_id,$charge) {
$EncodingValue = "";
$EncodingValue = "product_id=". $product_id .";charge=". $charge;
$EncodingTxt = Encoding($EncodingValue);
return $EncodingTxt;
}
function Encoding($EncodingValue){
$cmd = sprintf("jiami.exe W E \"%s\" ", $EncodingValue);
$EncodingTxt = exec($cmd);
return $EncodingTxt;
}echo $EncodingTxt;exit;
?>
<html>
<head>
<title>***</title>
<script type="text/javascript">
function testCount(){
var count1 = document.getElementById("txt_account").value;
var count2 = document.getElementById("txt_raccount").value;
if(count1!=count2){
alert("输入的账号不一致,请重新输入");
}else{
with(document.getElementById("form1")){
method="post";
action="http://***/abs.asp";
submit();
}
}
}
</script>
</head>
<body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0" onLoad="document.requestfrm.telnumber2.focus();SelCountry(document.requestfrm.area);">
<form id="form1">
<table width="374" height="415" border="0" align="center" cellpadding="0" cellspacing="1" style="border:1px solid #000000;">
<tr>
<td width="35%" align="center" height="50" valign="center"><font size="2.5px" color="#008000">* 充值金额</font></td>
<td width="65%" valign="bottom" height="50"><label>
<input type="radio" name="product_id" id="product_id" value="20302000" checked /><font size="2.5px">网易一卡通18元100点(18元)</font></label>
<br />
<label>
<input type="radio" name="product_id" id="product_id" value="20301000" />网易一卡通10元60点</label>
<br /><label> </td>
</tr>
<tr>
<td width="35%" align="center" height="50"><font size="2.5px" color="#008000"> * 需要充值的账户</font> </td>
<td width="65%" align="center" height="50"> <input name="txt_account" id="txt_account" size="25" value="" /> </td>
</tr>
<tr> <td align="center"><font size="2.5px" color="#008000">* 重复输入账户</font> </td>
<td align="center"> <input name="txt_raccount" id="txt_raccount" size="25" value="" onpaste='return false' oncontextmenu='return fasle'
onkeypress="return!(event.ctrlKey&&(String.fromCharCode(event.charCode=='v')))"/> </font> </td>
</tr>
<tr>
<td height="50" colspan="2" align="center">
<input type="button" name="sb_next" class="paysubmit" value="发送" onclick='testCount()' /> </td>
<INPUT TYPE="hidden" NAME="request" VALUE="<? echo($EncodingTxt) ?>">
</tr>
</table>
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货