שלום בניתי מערכת סקרים
קודם כל שולחים את מספר האפשריות שרוצים כאן
PHP קוד:
<?
switch($op) {
case "Add":
include 'add.php';
break;
default:
?>
<html dir="">
<h2>הוספת סקר לאתר - שלב ראשון</h2>
<center>
<form method="post" action="index.php?act=Polls&op=Add">
<table border="0" dir="center">
<tr>
<td>מספר האפשריות</td>
<td><input type="text" name="nums"></td></tr>
<tr><td align="right" colspan="2"><input type="submit" value="לשלב הבא"></td>
</tr>
</table>
</form>
</center>
</html>
<?
break;
}
?>
אחרי זה מכניסים את הסקר למסד.
פה יש לי את הבעיה עשיתי לולאה לחהציג את מספר התיבות טקסט של האפשריות אבל אין לי מושג איך להכניס אותם למסד למשהו יש רעיון ?
PHP קוד:
<?
$title = $_POST['title'];
$errors = '';
if ($_POST['send'] == 'send')
{
if ($title == '')
$errors = 'אנא הכנס שאלה לסקר<br>';
if($errors == '')
{
//כאן צריכה להיות ההכנס למסד
}
}
if($errors != '')
echo "<p align=center><font color=#ff0000>$errors</font></p>";
?>
<html dir="">
<center>
<form id="frm" name="frm" method="post" action="index.php?act=Polls&op=Add">
<input type="hidden" name="send" value="send">
<table border="0" dir="center">
<tr>
<td>שם הסקר</td></tr>
<td><input type="text" size="45" name="title"></td></tr>
<?
for ($i=1; $i<=$_POST[nums]; $i++)
{
echo "<td>אפשרות מספר: ".$i."<input type=\"text\" name=\"nums\"></td></tr> ";
}
?>
<tr><td align="right" colspan="2"><input type="submit" value="הוסף סקר"></td>
</tr>
</table>
</form>
</center>
</html>