Symbianize Forum

Most of our features and services are available only to members, so we encourage you to login or register a new account. Registration is free, fast and simple. You only need to provide a valid email. Being a member you'll gain access to all member forums and features, post a message to ask question or provide answer, and share or find resources related to mobile phones, tablets, computers, game consoles, and multimedia.

All that and more, so what are you waiting for, click the register button and join us now! Ito ang website na ginawa ng pinoy para sa pinoy!

patulong poh PHP( radio button foreach)

mayonakalee

Recruit
Basic Member
Messages
1
Reaction score
0
Points
16
pano ko po ba ma sto-store ang value nang mga radio button ko sa database gamit ang for each ?
hindi na poh talaga makaya nang utak ko
inikot-ikot ko na codes koh :weep:

--------------------------------------------------------------------------------------------------------------------------------------------

<?php
$query="SELECT * FROM questionnaire";
$result=mysql_query($query);
while($row=mysql_fetch_array($result))
{
$question_id=$row['id'];
?>
<tr>
<form method="post">
<td><?php echo $row['question']?></td>

<?php
$radio="SELECT * FROM evaluation_value"; // nag set poh ako ng value sa tig iisang radio button
$radioresult=mysql_query($radio) or die (mysql_error);
while($row=mysql_fetch_array($radioresult))
{
echo "<td><input type='radio' name='rate[]' value='".$row['rate_value']."'required></td>";

}
?>
</form>

<?php
}

?>

</tr>
</table>
<input type="submit" name="submit" value="Submit"> //submit button ko poh
<?php
if(isset($_POST['submit']))
{

$teach="SELECT subject_teacher,subject FROM schedule WHERE id='$id'";
$teachresult=mysql_query($teach);
while($rows=mysql_fetch_array($teachresult))
{
$teacher=$rows['subject_teacher'];
$code=$rows['subject'];
}

//--------------------- etoh na po yong foreach ko sa radio button --------------------------------//

$value=$_POST['rate'];
foreach($value as $check)
{
$studRecord = "INSERT INTO result (value,subject_teacher,subject,question_id) VALUES ('$check','$teacher','$code','$question_id')";
$studResult = mysql_query($studRecord) or die (mysql_error);
}
}
?>

--------------------------------------------------------------------------------------------------------------------------------------------------


Pagpasinsyahan nyo na po talaga codes ko hindi po ako ganun ka hasa :weep:

salamat poh
 
lagay mo tong code mo

Code:
<input type="submit" name="submit" value="Submit"> //submit button ko poh

before nung
Code:
</form>

then balik ka sakin kung nasolve problema mo :)
 
Last edited:
Back
Top Bottom