Problem with </select> using PHP?
Posted: Thu Oct 13, 2005 2:26 pm
Im trying to get list of options from a database into a select statment so the user can select one and nothing appears in my dropdown menu. the database is fine and the query is fine so im not usre what it is anyone help?
Code: Select all
<?php
require('database.class.php');
class admin
{
function get_meetings()
{
$database = new database();
$link_id = $database->database_connection();
$query = 'select event, meetingid from epc_meetings';
$result = @mysql_query($query, $link_id);
if (!$result)
return false;
$num_meetings = @mysql_num_rows($result);
if($num_meetings == 0)
return false;
$result = db_result_to_array($result);
return $result;
}
function db_result_to_array($result)
{
$res_array = array();
for ($count=0; $row = @mysql_fetch_array($result); $count++)
$res_array[$count] = $row;
return $res_array;
}
}
?>Code: Select all
<?php // ini_set ('display_errors', true );
require_once('../../spaw/spaw_control.class.php');
require_once('../../../classes/admin.class.php'); ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>EPC Website Administration: Presentation</title>
<link href="../../../css/epc_admin.css" rel="stylesheet" type="text/css" />
<script language="JavaScript" type="text/JavaScript">
<!--
function BRB_PHP_DelWithCon(deletepage_url,field_name,field_value,messagetext) { //v1.0 - Deletes a record with confirmation
if (confirm(messagetext)==1){
location.href = eval('\"'+deletepage_url+'?'+field_name+'='+field_value+'\"');
}
}
//-->
</script>
<script src="../../../includes/sorttable.js"></script>
</head>
<body>
<div id="heading">
<h1><a href="../../index.php">Website Adminstration</a>: Upload Presentations </h1>
<img src="../../../images/!genric/epc2.jpg" width="305" height="54" />
<div class="clear"></div>
</div>
<div id="main">
<p>[<a href="../index.php">Meeting Entries</a>]</p>
<form method="post" action="add.php" enctype="multipart/form-data">
<table border="0" cellpadding="0" cellspacing="0" class="editform" id="diary">
<tr>
<th scope="row">Meeting</th>
<td><select name="meetingid">
<?php
$x = new admin();
$meeting = $x->get_meetings();
$meeting_array=$meeting;
foreach ($meeting_array as $thismeeting)
{
echo '<option value="';
echo $thismeeting['meetingid'];
echo '"';
echo '>';
echo $thismeeting['event'];
echo'</option>';
echo"\n";
}
?>
</select></td>
</tr>
<tr>
<th scope="row">Title:</th>
<td><input type="text" name="event" id="event" size="50" maxlength="100" /></td>
</tr>
<tr>
<th scope="row">Author</th>
<td><input type="text" name="location" id="location" size="50" maxlength="120"/></td>
</tr>
<tr>
<th scope="row">File</th>
<td><input type="text" name="year" id="year" size="50" maxlength="40"/></td>
</tr>
<tr>
<th scope="row"> </th>
<td><input name="Submit" type="submit" title="Sumbit" value="Save"/></td>
</tr>
</table>
</form>
<p> </p>
</div>
</body>
</html>