Jump to content

[SOLVED] learning forms using dreamweaver (wheres the button?)


Recommended Posts

I am using dreamweaver 8.0 as editor to create a dynamic list/menu form thingy.

 

the click box pulls its values from a mysql table letting the user choose from 30 options.

 

however, there is no way to apply the choice..no Go button or anything.

 

just the label (class) and the drop down options..

 

I would like an apply button that when clicked would execute a mysql query.

 

Below is the code I use, its a bit sloppy due to the dreamweaver editor....

 

Thanks in advance for your time.

 

--------------------------------------

$query_Recordset1 = "SELECT `Class` FROM class_list ORDER BY id ASC";

$Recordset1 = mysql_query($query_Recordset1, $Lw) or die(mysql_error());

$row_Recordset1 = mysql_fetch_assoc($Recordset1);

$totalRows_Recordset1 = mysql_num_rows($Recordset1);

<head>

</head>

<body>

<form id="form1" name="form1" method="post" action="">

  <label>Class

  <select name="select">

    <?php

do { 

?>

    <option value="<?php echo $row_Recordset1['Class']?>"><?php echo $row_Recordset1['Class']?></option>

    <?php

} while ($row_Recordset1 = mysql_fetch_assoc($Recordset1));

  $rows = mysql_num_rows($Recordset1);

  if($rows > 0) {

      mysql_data_seek($Recordset1, 0);

  $row_Recordset1 = mysql_fetch_assoc($Recordset1);

  }

?>

  </select>

  </label>

  <label></label>

</form>

</html>

<?php

mysql_free_result($Recordset1);

?>

 

 

 

<?php
$query_Recordset1 = "SELECT `Class` FROM class_list ORDER BY id ASC";
$Recordset1 = mysql_query($query_Recordset1, $Lw) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>
<head>
</head>
<body>
<form id="form1" name="form1" method="post" action="">
  <label>Class
  <select name="select">
    <?php
do {  
?>
    <option value="<?php echo $row_Recordset1['Class']?>"><?php echo $row_Recordset1['Class']?></option>
    <?php
} while ($row_Recordset1 = mysql_fetch_assoc($Recordset1));
  $rows = mysql_num_rows($Recordset1);
  if($rows > 0) {
      mysql_data_seek($Recordset1, 0);
     $row_Recordset1 = mysql_fetch_assoc($Recordset1);
  }
  
?>
  </select>
  </label>
  <label></label>
  <input type="submit" name="submit" value="submit">
</form>
</html>
<?php
mysql_free_result($Recordset1);
?>

Thank you very much! That was exactly what I was struggling with.

 

Now of course I have to figure out how to make that submit button take the value of the drop box (i.e choice 1) and place it into a variable that I can call from the mysql query.

 

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.