mercredi 18 février 2015

php: how do i insert values into database from multiple dropdown list and added one text along with it


Vote count:

0




I have two table' displayed its data with 2 drop-down list so i want to add those selected value from both dropdown list and want to insert one Question(text) and one radio button value along with it! plz help me am little bit confuse :/ how to do with it ?


here is code



<div class="grid_10">
<div class="box round first">

<h2>Add / Edit Questions </h2>
<p>
</p>
</div>
</div>
<div class="grid_5">
<div class="box round">
<h2>
Add / Update Questions</h2>
<div class="block">
<p>
<table style="width:100%">
<tr>
<td>
<h2>Select Designation</h2>


<?php

$sql = "SELECT desg_name FROM 360d_designation";
$ds = mysql_query($sql) or die(mysql_error());
echo "<select>";
while($row = mysql_fetch_array($ds)){
echo "<option value='".$row["desg_id"]."'>".$row["desg_name"]."</option>";
}mysql_free_result($ds);
echo "</select>";



?>

</td>
<td>
<h2>Select Relation
</h2>
<?php
//<select id="id" name="selectstate" onChange="showCity(this.value)">
$sql = "SELECT rel_name FROM 360d_relations";
$rs = mysql_query($sql) or die(mysql_error());
echo "<select>";
while($row = mysql_fetch_array($rs)){
echo "<option value='".$row["rel_id"]."'>".$row["rel_name"]."</option>";
}mysql_free_result($rs);
echo "</select>";
//$rel = $row;
?>
</td>
</tr>


Enter Question : Point Scale Description

<?php


if(isset($_POST["btns"])){ //<-----Inserting data in to databse

$que_id = $_POST['que_id'];
$Que_detail = $_POST['Que_detail'];
$desg_id = $_POST['$ds'];
$rel_id = $_POST['$rs'];
$feedback_type = $_POST['$c1'];
$msg="";
if($que_id==0)
{
$q = "insert into 360d_app_questions values(null,'{$Que_detail}','{$desg_id}','{$rel_id}','{$feedback_type}')";
$msg = "added";
}
else
{
$q = "update 360d_app_questions set Que_detail ='{$Que_detail}' where que_id=".$que_id;
$msg = "updated";
}
$res = mysql_query($q,$con);
if($res)
echo "<h2>Question {$msg} sucessfully!!</h2>";
else
echo "question cannot be {$msg}";
}



?>

</center>



</p>



</div>
</div>
</div>
<div class="grid_5">
<div class="box round">
<h2>View Questions </h2>
<div class="block">
<p>


<?php
/* $qry = "select * from 360d_app_questions ";
$res = mysql_query($qry,$con);
if($res && mysql_num_rows($res)>0){
echo "<table cellspacing=10>".
"<tr><th><h2>Questions Manager </h2></th><th><h2> &nbsp &nbsp Edit</h2></th><th></th></tr>";
while($row = mysql_fetch_array($res)){
echo "<tr>".

"<td><h2>$row[1]</h2></td>".

"<td><a href='360d_addquestions.php?dept_id={$row[0]}'> <h2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;✉ <?php ?></h2></a></td>".
"</tr>";


}
echo "</table>";
*/ ?>







</p>
</div>
</div>
</div>
<div class="clear">
</div>
</div>
<div class="clear">
</div>


asked 2 mins ago







php: how do i insert values into database from multiple dropdown list and added one text along with it

Aucun commentaire:

Enregistrer un commentaire