基本上我一直试图在html中创建基本上创建事件的表单 此事件表作为来自另一个表的属性
CREATE TABLE `event` (
`event_id` int(4) NOT NULL AUTO_INCREMENT,
`event_type` int(4) NOT NULL,
`time` time NOT NULL,
`date` date NOT NULL,
`location` varchar(20) NOT NULL,
`home_or_away` text NOT NULL,
**`team_id` int(11) NOT NULL;**
CREATE TABLE `teams` (
**`team_id` int(4) NOT NULL AUTO_INCREMENT,**
`team_name` varchar(20) NOT NULL,
`team_location` varchar(20) NOT NULL,
`phone_no` varchar(20) NOT NULL,
`e_mail` varchar(20) NOT NULL,
PRIMARY KEY (`team_id`)
我一直在尝试创建的php允许在事件表中使用属性在team表对应的下拉列表中查找值team_id。 我一直在创建一些查询,但不幸的是它没有工作:(
<html>
<body>
<title>forms</title>
<link rel="stylesheet" type="text/css" href="css/global.css" />
</head>
<body>
<div id="container">
<form action="insert1.php" method="post">
<h1>Enter User Details</h1>
<h2>
<p><label for="event_id">User ID: </label><input type="text" name="User ID" /></p>
<p><label for="event_type">event type: </label><input type="text" name="event_type" /> </p>
<p><label for="time">time: </label><input type="text" name="time" /></p>
<p><label for="location">location: </label><input type="text" name="location" /></p>
<p><label for="home_or_away">Age: </label><input type="text" name="home_or_away" /></p>
<p><label for="team_id">Phone_No: </label><input type="text" name="team_id" /> </p>
<p><input type="submit" name="submit" value="Send" /></p></h2>
</form>
</div>
</body>
</html>
<?php
// DATABASE CONNECTIVITY
if(isset($_POST['search_value'])) {
$val = $_POST['search_value'];
<?php
// DATABASE CONNECTIVITY
if(isset($_POST['search_value'])) {
$val = $_POST['search_value'];
$query = mysql_query("SELECT * FROM helpline WHERE MISC LIKE %$val%");
// NOW RUN YOUR QUERY
$result = '<table border="0" cellpadding="6" cellspacing="6" class="curve">';
$result .= '<thead>';
$result .= '<tr>';
$result .= '<th> <div align="right"><span class="font">NAME</span></div></th>';
$result .= '<th> <div align="right"><span class="font">DATE</span></div></th>';
$result .= '</tr>';
$result .= '</thead>';
while($row = mysql_fetch_array($query)){
$result .= '<tr>';
$result .= '<th><div align="left"><span class="font">'.$row['name'].'</span></div></th>';
$result .= '<td><div align="left"><span class="font">'.$row['date'].'</strong></span></div></td>';
$result .= '</tr>';
}
$result .= '</table>';
echo $result;
}
?>