zgkhoo Posted November 8, 2007 Share Posted November 8, 2007 part of the code <?php if(isset($_POST[click])){ echo "<br>exchange clicked"; echo "</br>expoint=".$_P0ST[point]; //$sql="INSERT INTO gptran (TranDate,Mode,UserID,TranPoint,Purpose,FromWhere,ToWhere) // VALUES // (NOW(),'Debit','$login',$_P0ST[Expoint],'EXCHANGE2CASH','UserPoint','UserCash')"; // mysql_query($sql); // $sql="INSERT INTO gptran (GpTID,TranDate,Mode,UserID,TranPoint,Purpose,FromWhere,ToWhere) // VALUES // (lastGpTID(),NOW(),'Debit','$login',$_P0ST[expoint],'EXCHANGE2CASH','UserPoint','UserCash')"; // mysql_query($sql); } ?> <html> <form action="displaygamep.php" method="POST"> <input type="text" name="point"> <input type="submit" name="click"> </form> </html> which this echo "</br>expoint=".$_P0ST[point]; showing nothing... wat happen? ??? Link to comment https://forums.phpfreaks.com/topic/76512-this-form-wont-passing-the-numeric-value/ Share on other sites More sharing options...
trq Posted November 8, 2007 Share Posted November 8, 2007 Associative arrays are indexed by strings. The syntax is $arr['var'], not $arr[var]. This is displaygamep.php were looking at? Your code works fine here apart from the syntax errors I just posted. Link to comment https://forums.phpfreaks.com/topic/76512-this-form-wont-passing-the-numeric-value/#findComment-387525 Share on other sites More sharing options...
Orio Posted November 8, 2007 Share Posted November 8, 2007 It's wrong to use bare-strings as array keys. You should have single quotes around them: $_POST[point] //wrong $_POST['point'] //right Read the part of "Array do's and don'ts" in the manual. Orio. Link to comment https://forums.phpfreaks.com/topic/76512-this-form-wont-passing-the-numeric-value/#findComment-387528 Share on other sites More sharing options...
zgkhoo Posted November 8, 2007 Author Share Posted November 8, 2007 <?php $login=$_SESSION['UserID']; $login=1009; include '../../../config.php'; include '../../../opendb.php'; echo "</br>login=".$login; echo "calculate ur total game point"; $totalpoint=0; echo "show all ur gamepoint,and total it up !"; echo"<left><table border=1><tr> <td>GpTID</td><td>TranDate</td><td>Mode</td><td>UserID</td><td>CardSerial</td><td>Point Earn</td><td>Purpose</td><td>BenefitFrom</td><td>BenefitFlevel</td></tr>"; //finding all card that owner owned $result=mysql_query("SELECT * from gptran WHERE UserID='$login'")or die('Query failed: ' . mysql_error()); while($row = mysql_fetch_array($result,MYSQL_ASSOC)){ echo "<tr><td>$row[GpTID]</td><td>$row[TranDate]</td><td>$row[Mode]</td><td>$row[userID]</td><td>$row[CardSerial]</td><td>$row[TranPoint]</td><td>$row[Purpose]</td><td>$row[benefitFrom]</td><td>$row[benefitFlevel]</td></tr>"; $totalpoint+=$row[TranPoint]; }//end while echo "</br> Your total game point=".$totalpoint; echo "</table></left>"; function lastGpTID(){ //finding the lastGpTID in DB echo "</br></br>enter last gpTID function"; $result2=mysql_query("SELECT * from dbstore"); while($row2 = mysql_fetch_array($result2,MYSQL_ASSOC)){ return $row2[LastGpTID]; } } if(isset($_POST[click])){ echo "<br>exchange clicked"; echo "</br>expoint=".$_P0ST['point']; echo "</br>test=".$_P0ST[test]; //$sql="INSERT INTO gptran (TranDate,Mode,UserID,TranPoint,Purpose,FromWhere,ToWhere) // VALUES // (NOW(),'Debit','$login',$_P0ST[Expoint],'EXCHANGE2CASH','UserPoint','UserCash')"; // mysql_query($sql); // $sql="INSERT INTO gptran (GpTID,TranDate,Mode,UserID,TranPoint,Purpose,FromWhere,ToWhere) // VALUES // (lastGpTID(),NOW(),'Debit','$login',$_P0ST[expoint],'EXCHANGE2CASH','UserPoint','UserCash')"; // mysql_query($sql); } ?> <html> <form action="displaygamep.php" method="POST"> <input type="text" name="point"> <Input type="text" name="test"> <input type="submit" name="click"> </form> </html> i changed...still the same output after i input number and click the submit button: exchange clicked expoint= weird.. ??? ??? ??? Link to comment https://forums.phpfreaks.com/topic/76512-this-form-wont-passing-the-numeric-value/#findComment-387533 Share on other sites More sharing options...
trq Posted November 8, 2007 Share Posted November 8, 2007 You have had this same issue before $_POST has a the letter O (naught) in it, not the number 0 (zero). You really need to turn on error reporting. Place this at the top of ALL your scripts in the future. <?php error_reporting(E_ALL); ini_set('display_errors','1'); ?> Link to comment https://forums.phpfreaks.com/topic/76512-this-form-wont-passing-the-numeric-value/#findComment-387574 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.