0
在此先感謝,其實在我的應用程序中,我有一個帶有「添加到購物車」提交按鈕的表單,因此無論何時提交一個形成文本字段值應該通過對話,它應該低於其他類似的一行在不同的HTML表格的形式下面這樣添加的,而不是在MySQL table.Something如下如何在一個html表格行中逐個添加會話值php
Exam Name | Venue Name | Date of Exam | Price | No.of Exam
PMP | venue1 |23-12-2016 | $40 | 2
ITIL | venue2 |24-12-2016 | $30 | 2
My code as below
<?php
session_start();
$course = $_POST['course'];
$venue = $_POST['venue'];
$date = $_POST['Userdate'];
$price = $_POST['txtprice'];
$noExams = $_POST['num_exams'];
$_SESSION['course'] = $course;
echo $_SESSION['course'];
?>
<html>
<head></head>
<body>
<form method="post" action="shopping.php">
<table><thead>
<th>Exam Name</th>
<th>Venue Name</th>
<th>Date of Exam</th>
<th>Price/Course</th>
<th>Number of Exams</th>
<th>Add to Cart</th>
</thead>
<tbody>
<tr>
<td>
<select name="course">
<option value="">--Select--</option>
<option value="ITIL Foundation">ITIL Foundation</option>
<option value="PMP">PMP</option>
<option value="">Prince 2 Foundation</option>
</select>
</td>
<td><input type="text" name="venue" id="venue" required="required"></td>
<td><input type="text" name="Userdate" id="Userdate" required="required"></td>
<td><input type="text" name="txtprice" id="Userdate" required="required"></td>
<td>
<select name="num_exams" required="required">
<option value="">--Select--</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select>
</td>
<td><input type="submit" name="btnSubmit" value="Submit"></td>
</tr></tbody>
</form>
</body>
</html>