我有我創建的評論表單。它從數據庫中獲取id並打印出與該id一起使用的數據,但它所做的是將這些信息打印到表單中。我想要一個空白表單,以便用戶可以向記錄添加評論。php評論表
任何想法?
這窗體的代碼:
<form method="post" action="pv.php?id=<?php echo $row['ID']?>&action=<?php echo $form_action ?>">
<fieldset>
<legend></legend>
<p>
<label for="cname">Date Of Birth</label> *
<input id="cname" name="dateofbirth" class="required date" value="<?php echo $row['Date_Of_Birth']?>" /> (eg 1978.11.11)
</p>
<p>
<label for="cgender">Gender</label> *
<input type="radio" name="gender" value="Male" <?php if($row['Gender']=='male'){echo 'checked';}?>/> Male <input type="radio" name="gender" value="Female" <?php if($row['Gender']=='female'){echo 'checked';}?>/> Female </td>
</p>
<p>
<label for="curl">Title</label> *
<select name="title" id="title" class="required">
<option value="">Please Select</option>
<option value="Mr" <?php if($row['Title']=='Mr'){echo 'selected';}?>>Mr</option>
<option value="Ms" <?php if($row['Title']=='Ms'){echo 'selected';}?>>Ms</option>
<option value="Mrs" <?php if($row['Title']=='Mrs'){echo 'selected';}?>>Mrs</option>
<option value="Miss" <?php if($row['Title']=='Miss'){echo 'selected';}?>>Miss</option>
<option value="Other" <?php if($row['Title']=='Other'){echo 'selected';}?>>Other</option>
</select>
</p>
<p>
<label for="ccomment">First Name</label> *
<input type="text" name="firstname" value="<?php echo $row['First_Name']?>" maxlength="50" />
</p>
<p>
<label for="cemail">Last Name</label> *
<input id="cemail" type="text" name="lastname" value="<?php echo $row['Last_Name']?>" maxlength="75" />
</p>
<p>
<label for="ccomment">Address 1</label>*
<input type="text" name="address1" value="<?php echo $row['Address_Line_1']?>" maxlength="50" />
</p>
<p>
<label for="ccomment">Address 2</label>
<input type="text" name="address2" value="<?php echo $row['Address_Line_2']?>" maxlength="50" />
</p>
<p>
<label for="ccomment">City</label>*
<input type="text" name="city" value="<?php echo $row['City']?>" maxlength="50" />
</p>
<p>
<label for="ccomment">Postcode</label>*
<input type="text" name="postcode" value="<?php echo $row['Postcode']?>" maxlength= "10" /> (eg LE5 5QE)
</p>
<p>
<label for="ccomment">Contact No</label>*
<input type="text" name="contactno" value="<?php echo $row['Contact_No']?>" maxlength= "12" /> (eg 077448825723)
</p>
<p>
<label for="ccomment">Email</label>*
<input type="text" name="email" value="<?php echo $row['Email']?>" maxlength= "40"/> (eg [email protected])
</p>
<p>
<label for="ccomment">Comment</label>
<textarea rows="10" cols="30" name="note" maxlength= "500"><?php echo $row['Additional_Comment']?></textarea>
</p>
<p>
<input class="submit" type="submit" value="Submit"/>
</p>
<p>
<a href='pv.php'>Main Page</a>
</p>
</fieldset>
這是一頁上打印出來的數據代碼:
if($_GET['action']=='comment'){
$form_action = 'comment_ok';
$id=$_GET['id'];
$result = mysql_query("SELECT * FROM project_data WHERE id='$id'");
$row = mysql_fetch_array($result);
echo'<b>';
echo $row['Date_Of_Birth'];
echo '  ';
echo $row['Gender'];
echo '  ';
echo $row['Title'];
echo '  ';
echo $row['First_Name'];
echo '  ';
echo $row['Last_Name'];
echo '  ';
echo $row['Address_Line_1'];
echo '  ';
echo $row['Address_Line_2'];
echo '  ';
echo $row['City'];
echo '  ';
echo $row['Postcode'];
echo '  ';
echo $row['Contact_No'];
echo '  ';
echo $row['Email'];
echo '  ';
echo $row['Additional_Comment'];
echo '</b>';
}
,我的代碼片段用於將ID發送到表格:
echo "<td><a href='pv.php?action=edit&id=" . $row['ID']."'>Edit</a>  <a href='pv.php?action=delete_ok&id=" . $row['ID']."'>Delete</a>  **<a href='pv.php?action=comment&id=" . $row['ID']."'>Comment</a></td>"**;
echo "</tr>";
任何人有任何想法?
請給您的問題添加一些代碼,否則很難給您提供建議 –
我認爲您需要更具體些,例如通過提供代碼示例。 – Yuri
如果這沒有幫助,我會把整個項目的代碼:D – mayman212