hello everyone.. i am using php script, n the input data is to be filled in database-sqlyog..i've question,the database is just for storing data right? so i just create tables in sqlyog. as for the server connection, apache and mysql, i use xampp. i code: <form name="noledge" action="sectionc.php" method="post"> <td><input type="radio" name="rad1" value="1"/></td> <td><input type="radio" name="rad1" value="2"/></td> <td><input type="radio" name="rad1" value="3"/></td> <td><input type="radio" name="rad1" value="4"/></td> <td><input type="radio" name="rad1" value="5"/></td> <td><input type="radio" name="rad1" value="6"/></td> <td><input type="radio" name="rad1" value="7"/></td> <td><input type="radio" name="rad1" value="8"/></td> <td><input type="radio" name="rad1" value="9"/></td> <td><input type="radio" name="rad1" value="10"/></td> </form> then..in sectionc.php <?php session_start(); $user="root"; $host="localhost"; $password="password"; $database="borang"; $link= mysql_connect($host,$user,$password) or die ("unable to connect to server"); $db = mysql_select_db($database,$link) or die ("unable to locate database"); $code=mysql_set_charset($link,'utf8') or die ("unable to set connection coding"); $value = $_REQUEST[$rad1[0]]; $sql="INSERT INTO section_c (`C1`) VALUES ('$value') "; $result=mysql_query($sql) or die("unable to execute query"); ?> i suppose that the value of 1 will be set in column C1 in the table section_c, correct? it does not, so..what did i miss here? Onegai shimasu..
I don't see an input type of "submit" how are you even submitting without a submit button (or any button for that matter). Also $_REQUEST[$rad1[0]]; needs to be $_REQUEST['rad1'];
oops..sory..i did put <input type="submit" name="send" value="HANTAR"> at the end of all my radio button groups. err..one more thing..can u tell me the diffrence btw $_REQUEST n $_POST?cus just now somone told me to change the request to post..
If you sent something via get it can be retrieved with $_GET if you send something via post it can be retrieved with $_POST, $_REQUEST can receive either, but like register_globals() , it can be considered insecure as it means someone could pass the same information to your script via just the url. It's generally best practice to limit the scope of your script to the method of traffic you expect to receive to cut down on possible exploits. $_REQUEST can be handy if you're debugging a script using either method, but when it goes live pick one or the other.