Ben var bir tabloya değer koymak için bir PHP formu kullanarak ediyorum. Sorun yerine açılan metnin, bu açılan seçimin değerini koyar olmasıdır dışında her şey çalışıyor.
Ben tarih ve saatleri bağlamak çalıştığınızda da, bu şekilde başka bir MySQL satır yapar ve o satırda eğik ve iki nokta üst üste koyar.
Düzeltmek için herhangi bir yardım?
(Ben bir form makinesi kullanılan formu vermedi)
İşte kod:
<div id="form_container">
<ul >
<li id="li_4" >
<label class="description" for="element_4">restaurant </label>
<div>
<select class="element select medium" id="element_4" name="element_4">
<option value="" selected="selected"></option>
<option value="1" >Burger King</option>
<option value="2" >McDonald's</option>
<option value="3" >Wendy's</option>
<option value="4" >KFC</option>
<option value="5" >Taco Bell</option>
<option value="6" >Domino's Pizza</option>
<option value="7" >Pizza Hut</option>
<option value="8" >Quizno's</option>
<option value="9" >Chili's</option>
<option value="10" >TGI Friday's</option>
<option value="11" >Starbucks</option>
<option value="12" >Red Lobster</option>
<option value="13" >Olive Garden</option>
</select>
</div>
</li> <li id="li_1" >
<label class="description" for="element_1">date </label>
<span>
<input id="element_1_1" name="element_1_1" class="element text" size="2" maxlength="2" value="" type="text"> /
<label for="element_1_1">MM</label>
</span>
<span>
<input id="element_1_2" name="element_1_2" class="element text" size="2" maxlength="2" value="" type="text"> /
<label for="element_1_2">DD</label>
</span>
<span>
<input id="element_1_3" name="element_1_3" class="element text" size="4" maxlength="4" value="" type="text">
<label for="element_1_3">YYYY</label>
</span>
<span id="calendar_1">
<img id="cal_img_1" class="datepicker" src="calendar.gif" alt="Pick a date.">
</span>
<script type="text/javascript">
Calendar.setup({
inputField : "element_1_3",
baseField : "element_1",
displayArea : "calendar_1",
button : "cal_img_1",
ifFormat : "%B %e, %Y",
onSelect : selectDate
});
</script>
</li> <li id="li_2" >
<label class="description" for="element_2">time </label>
<span>
<input id="element_2_1" name="element_2_1" class="element text " size="2" type="text" maxlength="2" value=""/> :
<label>HH</label>
</span>
<span>
<input id="element_2_2" name="element_2_2" class="element text " size="2" type="text" maxlength="2" value=""/> :
<label>MM</label>
</span>
<span>
<input id="element_2_3" name="element_2_3" class="element text " size="2" type="text" maxlength="2" value=""/>
<label>SS</label>
</span>
<span>
<select class="element select" style="width:4em" id="element_2_4" name="element_2_4">
<option value="AM" >AM</option>
<option value="PM" >PM</option>
</select>
<label>AM/PM</label>
</span>
</li> <li id="li_3" >
<label class="description" for="element_3">catering </label>
<span>
<input id="element_3_1" name="element_3" class="element radio" type="radio" value="1" />
<label class="choice" for="element_3_1">Yes</label>
<input id="element_3_2" name="element_3" class="element radio" type="radio" value="2" />
<label class="choice" for="element_3_2">No</label>
</span>
</li> <li id="li_5" >
<label class="description" for="element_5">driver </label>
<div>
<select class="element select medium" id="element_5" name="element_5">
<option value="" selected="selected"></option>
<option value="1" >Derek</option>
<option value="2" >Joe</option>
</select>
</div>
</li> <li id="li_6" >
<label class="description" for="element_6">destination </label>
<div>
<select class="element select medium" id="element_6" name="element_6">
<option value="" selected="selected"></option>
<option value="1" >NYC</option>
<option value="2" >LA</option>
<option value="3" >Chicago</option>
<option value="4" >Boston</option>
<option value="5" >Miami</option>
<option value="6" >San Francisco</option>
<option value="7" >Seattle</option>
<option value="8" >Other</option>
</select>
</div>
</li>
<li class="buttons">
<input type="hidden" name="form_id" value="76657" />
<input id="saveForm" class="button_text" type="submit" name="submit" value="Submit" />
</li>
</ul>
</form>
</div>
<img id="bottom" src="bottom.png" alt="">
</body>
</html>
PHP kodu
<?php
$restaurant = $_POST['element_4'];
$dateM = $_POST['element_1_1'];
$dateD = $_POST['element_1_2'];
$dateY = $_POST['element_1_3'];
$timeH = $_POST['element_2_1'];
$timeM = $_POST['element_2_2'];
$timeS = $_POST['element_2_3'];
$amPM = $_POST['element_2_4'];
$catering = $_POST['element_3'];
$driver = $_POST['element_5'];
$destination = $_POST['element_6'];
$date = $dateM . "/" . $dateD . "/" . $dateY;
$time = $timeH . ":" . $timeM . ":" . $timeS . " " . $amPM;
$con = mysql_connect("localhost","asdf","asdf");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("tableName", $con);
mysql_query("INSERT INTO stats (restaurant, date, time, catering, driver, destination)
VALUES ('$restaurant', '$date', '$time', '$catering', '$driver', '$destination')");
mysql_close($con);
?>