0

Hi
I'm trying to get reviewerid, firstname and last name through a drop down selection box in my html form. The code below is line 26-38 from the attachment. Currentl, it echoes to the browser much of what you see here, rather than pulling the data and displaying it in a drop down. I'd appreciate any advice.

<?php
require ("dbcnx.php");

  $get_type=mysql_query("SELECT reviewerid, firstname, lastname FROM reviewer");
  /* create form containing selection list */

        echo "<select name='reviewerid'>\n";

  while ($row3 = mysql_fetch_array($get_type))
  {
     extract($row3);
     echo "<option value='$reviewerid'> $reviewerid $firstname $lastname \n</option>";

  }
  echo "</select>\n";
  ?>
Attachments
<!DOCTYPE html>
<html lang = en>
<head>
<title>reviewparts</title>
<meta  charset= "utf-8" />
</head>
<body>
<table width="400" border="0" align="center" cellpadding="3" cellspacing="0">
<tr>
<td><strong>Add reviewparts details </strong></td>
</tr>
</table>
<table width="400" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
<tr>
<!-- the enctype is critical here. Omit at your peril-->
<form enctype="multipart/form-data" method="post" action="add_reviewparts.php">
<td>
<table width="400" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF">
<tr>
<td width="117">name:</td>
<td width="14">:</td>
<td width="357">
<?php
require ("dbcnx.php");

  $get_type=mysql_query("SELECT reviewerid, firstname, lastname FROM reviewer");
  /* create form containing selection list */
  
        echo "<select name='reviewerid'>\n";

  while ($row3 = mysql_fetch_array($get_type))
  {
     extract($row3);
     echo "<option value='$reviewerid'> $reviewerid $firstname $lastname \n</option>";
	 
  }
  echo "</select>\n";
  ?>
  </td>
</tr>
<tr>
<td width="117">starrating</td>
<td width="14">:</td>
<td width="357"><input name="starrating" type="text" id="type" size="5" /></td>
</tr>
<tr>
<td width="117">reviewtitle</td>
<td width="14">:</td>
<td width="357"><input name="reviewtitle" type="text" id="type" size="25" /></td>
</tr>
<tr>
<td width="117">review</td>
<td width="14">:</td>
<td width="357"><input name="review" type="text" id="type" size="250" /></td>
</tr>
<tr>
<td width="117">triptype</td>
<td width="14">:</td>
<td width="357"><input name="triptype" type="text" id="type" size="25" /></td>
</tr>
<tr>
<td width="117">date</td>
<td width="14">:</td>
<td width="357"><input name="date" type="text" id="type" size="10" /></td>
</tr>
<tr>
<td width="117">wifi</td>
<td width="14">:</td>
<td width="357"><input name="wifi" type="text" id="type" size="3" /></td>
</tr>
<tr>
<td width="117">whatsitknownfor</td>
<td width="14">:</td>
<td width="357"><input name="whatsitknownfor" type="text" id="type" size="100" /></td>
</tr>
<tr>
<td width="117">servicerating</td>
<td width="14">:</td>
<td width="357"><input name="servicerating" type="text" id="type" size="5" /></td>
</tr>
<tr>
<td width="117">cleanlinessrating</td>
<td width="14">:</td>
<td width="357"><input name="cleanlinessrating" type="text" id="type" size="5" /></td>
</tr>
<tr>
<td width="117">valuerating</td>
<td width="14">:</td>
<td width="357"><input name="valuerating" type="text" id="type" size="5" /></td>
</tr>
<tr>
<td width="117">roomtips</td>
<td width="14">:</td>
<td width="357"><input name="roomtips" type="text" id="type" size="100" /></td>
</tr>
<tr>
<td width="117">hotelstyle</td>
<td width="14">:</td>
<td width="357"><input name="hotelstyle" type="text" id="type" size="50" /></td>
</tr>
<tr>
<td><input type="submit" name="Submit" value="Submit" /> </td>
</table>
</body>
</html>
3
Contributors
2
Replies
12
Views
1 Year
Discussion Span
Last Post by diafol
0

Just a note - you're using deprecated code - maybe better to use mysqli / PDO. You could also use bind_result() / bindColumn() instead of extract(), but that's another story.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.