السلام عليكم
اخواني اريد ادخال ثلاث اسئله واجوبتها الـ4 في قاعدة البيانات وكل سؤال وجواب id مختلف عن السؤال الثاني واجوبته
الكود مشكلته انه يدخل اخر سؤال فقط
الكود
كود PHP:
<?php
session_start();
if(!session_is_registered(myusername)){
header("location:../login.php");
}
$host="localhost";
$username="root";
$password="";
$db_name="kope";
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
$fullname='1';
if($_GET['action']=="df"){
$question=$_POST['question'];
$answer1=$_POST['answer1'];
$choose1=$_POST['choose1'];
$answer2=$_POST['answer2'];
$choose2=$_POST['choose2'];
$sql2="INSERT INTO df (id, question, idtitle, answer1, choose1, answer2, choose2) VALUES
('', '$question', '$fullname', '$answer1','$choose1', '$answer2','$choose2')";
$result2=mysql_query($sql2) or die(mysql_error());
if($result2){
echo "ok";
}
else {
$result2=mysql_query($sql2) or die(mysql_error());
}
}
?>
<html dir="rtl">
<td><form name="df" method="post" action="df.php?action=df"></td>
<td>الاسم</td>
<td><input name="fullname" type="text" id="fullname" value="<?php echo $fullname; ?>"></td>
<td>السؤال الاول</td>
<td><input name="question" type="text" id="question"></td>
<td>الاجابة</td>
<td><input name="choose1" type="text" id="choose1" >
<td><input name="answer1" type="text" id="answer1" >
<td>الاجابة</td>
<td><input name="choose2" type="text" id="choose2" >
<td><input name="answer2" type="text" id="answer2" >
<br><br>
<td>السؤال الثاني</td>
<td><input name="question" type="text" id="question"></td>
<td>الاجابة</td>
<td><input name="choose1" type="text" id="choose1" >
<td><input name="answer1" type="text" id="answer1" >
<td>الاجابة</td>
<td><input name="choose2" type="text" id="choose2" >
<td><input name="answer2" type="text" id="answer2" >
<br><br>
<td>السؤال الثالث</td>
<td><input name="question" type="text" id="question"></td>
<td>الاجابة</td>
<td><input name="choose1" type="text" id="choose1" >
<td><input name="answer1" type="text" id="answer1" >
<td>الاجابة</td>
<td><input name="choose2" type="text" id="choose2" >
<td><input name="answer2" type="text" id="answer2" >
<td><input type="submit" name="Submit" value=" إرسال " ></td>
</form>