Ok in my database there is a field called frames the vles in this field are like so: DX100A, HX1001, CX100A
in editpilot.php i want these turned into selections in a drop down box
problem being i can explode the field i just cant get it to work with the selection box?
because i dont know exactly how many values there are in "Frames" as it can vary between pilot?
so:
1) how do i get it to explode "Frames" and turn them into selections in a drop down box?
editpilot.php
<?php
session_start();
$id = $_REQUEST['id'];
include "config.php3";
if($_SESSION['loggedin'] == TRUE)
{
if($id == 'new')
{
echo "Welcome To The Pilot Editor";
print("
<form method='post' action='newpilot.php'>
Pilot ID:
<input ype='text' value='' name='pid'>
<br><br>
Select Frames:
<br>");
include 'selection.php3';
print("
Pilot Hours:
<input ype='text' value='' name='phours'>
<br><br>
Pilot Level:
<br><font size='-1'>1=Admin 2=Standard Member
<input ype='text' value='' name='usrlvl'>
<br><br>
<input type='submit' name='update' value='Create It'>
");
}
else
{
$query = mysql_query("SELECT * FROM $table3 WHERE id='$id'");
while($row = mysql_fetch_array($query))
{
$pid = $row['id'];
$usrlvl = $row['usrlvl'];
$phours = $row['hours'];
$pframes = $row['frames'];
$email = $row['email'];
$password = $row['password'];
$echohours = wordwrap($phours, 2, ':', 1);
}
///exploding the "Frames" Field
$frames1 = explode(",",$pframes);
//i though i could create a counter so it count all the results? but didnt work lol
for ($i=0;$i<36;$i++)
{
$frames1 = $frames1[0];
}
echo "Welcome To The Pilot Editor";
print("
<form method='post' action='editpilot.php3'>
Pilot ID:<br>
<input ype='text' value='$pid' name='pid'>
<br>
Email Address:<br>
<input type='text' value='$email' name='email'>
<br>
Password:<br>
<input type='password' value='' name='pass'>
<br>
Select Frames:
<br>");
include 'selection.php3';
print("<br>
Pilot Hours:<br>
<input ype='text' value='$phours' name='phours'>
<br>
Pilot Level:
<br><font size='-1'>1=Admin 2=Standard Member<br>
<input ype='text' value='$usrlvl' name='usrlvl'>
<br><br>
<input type='submit' name='update' value='Amend It'>
");
}
}
else
{
echo "<font color='red'><b>You Are Not Authorized To View This Page Please Go Back Or Login Below</font>";
include "login.htm";
}
?>
selection.php3
<?php
include "config.php3";
$query = mysql_query("SELECT * FROM $table ORDER BY id ASC") or die(mysql_error());
while($row = mysql_fetch_array($query)){
$frame1 = $row['frame'];
if($frame1 == $frames2)
{
//displays the pilots allowed frames
$frame .= "<option selected>$frame1</option>";
}
else
{
//displays un-allowed frames
$frame .= "<option>$frame1</option>";
}}
echo "<select size='8' name='frames' multiple>";
echo $frame;
echo "</select>";
?>