chiaki*misu Posted August 13, 2009 Share Posted August 13, 2009 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"); $sql="INSERT INTO section_c (C1) VALUES ($_REQUEST[ $rad1[0] ]); $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.. Link to comment https://forums.phpfreaks.com/topic/170012-it-does-not-submitted-to-database/ Share on other sites More sharing options...
ohdang888 Posted August 13, 2009 Share Posted August 13, 2009 do this: $value = $_REQUEST[$rad1[0]]; $sql="INSERT INTO section_c (`C1`) VALUES ('$value') "; Link to comment https://forums.phpfreaks.com/topic/170012-it-does-not-submitted-to-database/#findComment-896881 Share on other sites More sharing options...
chiaki*misu Posted August 13, 2009 Author Share Posted August 13, 2009 thanks for the reply.. ive tried that..still dont work..or it is about the database? Link to comment https://forums.phpfreaks.com/topic/170012-it-does-not-submitted-to-database/#findComment-896924 Share on other sites More sharing options...
PFMaBiSmAd Posted August 13, 2009 Share Posted August 13, 2009 The form data will be in $_POST['rad1'] To see what you are actually getting from the form, use the following debugging code - <?php echo "<pre>"; echo "POST:"; print_r($_POST); echo "</pre>"; ?> Link to comment https://forums.phpfreaks.com/topic/170012-it-does-not-submitted-to-database/#findComment-896938 Share on other sites More sharing options...
chiaki*misu Posted August 13, 2009 Author Share Posted August 13, 2009 so what i should do is: <?php session_start(); include("bore.inc"); include("connection.inc"); include("debug.inc"); //i've saved the code given in an .inc file $value = $_POST['rad1']; $sql="INSERT INTO section_c (`C1`) VALUES ('$value') "; mysql_query($sql) or die(mysql_error()); ?> then..where will the debug file notify me the value selected from the $_POST? Link to comment https://forums.phpfreaks.com/topic/170012-it-does-not-submitted-to-database/#findComment-896947 Share on other sites More sharing options...
chiaki*misu Posted August 13, 2009 Author Share Posted August 13, 2009 :'( plisss..anyone..? Link to comment https://forums.phpfreaks.com/topic/170012-it-does-not-submitted-to-database/#findComment-896956 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.