I have a form with a select list and a hidden field to save the selected
item. On submit another page is loaded with a few fields to be filled in
and submitted to a table. Using get I see the data is being passed from
the first page to the second properly, and the second page sends its
data properly. The hidden field from the first page is to be used by the
second page as the name of the table in the query. I have a place where
I echo the contents of the hidden field just to be sure it is correct,
and that does indeed show what I expect. I then make the query statement
point to the variable but it always responds that it cannot find the
table. The table does exist, the variable does contain the appropriate
table name, but is not being replaced by the name. What am I doing

Chip W

Below is the code for the first page --

<div align="center">

echo "<form action='workout-absflexor.php' method='get'>";
echo "<table width='70%' border='0' align='center'>";
echo "<tr><th align='center'><h2>Exercise Data Input</h2></th></tr>";
echo "<tr><th align='center'><select name='listbox'>";
echo "<option>$exercises[0]</option>";
echo "<option>$exercises[1]</option>";
echo "<option>$exercises[2]</option>";
echo "</select><br><br>";
echo "</th></tr></table>";
echo "<input type='hidden' name='exerciselist' value='$listbox'>";
echo "<input type='submit'>";
echo "</form>";

And below is the code for the second page --

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
<html xmlns="http://www.w3.org/1999/xhtml";>
    <title>Workout Data Entry Form</title>
<style type="text/css">
 body { background-color: aqua; }
 div.c1 {text-align: center}
    <div class="c1">
      <h2>Work-Out Data Entry Screen</h2>
      <form action="<? PHP_SELF ?>" method="get">
        <table summary="" width="60%" border="1" align="center"
            <td align="left"><input type="text" name="exercise"
            <td align="left"><input type="text" name="reps"
            <td colspan="2"><textarea cols="50" rows="3"
          <tr><td><? echo $listbox; ?></td></tr>
        <br />
        <input type="submit" name="submit" value="Send Data" /> <input
type="reset" />
  $db = mysql_connect("localhost","root","carvin");
  if(!$db) error_message(sql_error());
  mysql_select_db("workout",$db) or die ("Ack! Where's the database?");
  $date = date("m-d");
  $sql = "insert into $listbox
  mysql_query($sql) or die ("Ack! No response when I queried the

PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to