Jump to content

echo a variable in a form based on user selection


jeff5656

Recommended Posts

Here's part of the form:

<select name = "pulmonologist" >
<option selected="" value="">---Select---
<option value="none">None</option>
<?php		
while ($row2 = mysql_fetch_assoc ($results2)) {   
        ?><option value = "<?php echo $row2['staff_name'];?>"><?php echo $row2['staff_name'];?></option>
<?php }
?>
</select>

 

Ok now I want to echo the value that the user selects in the SAME page  (i.e. before the submit button is pressed) like this:

 

<input type="submit" value = "Contact <?php echo $pulmonologist;?>" />

 

Do you have any thoughts on how to do this?  Thanks!

Ugh.  Ok I'm off to google in search for a javascript forum (and I know nothing about javascript other than downloading pre-made js scripts, so wish me luck :-)  )

 

We have a javascript sub-section: http://www.phpfreaks.com/forums/index.php/board,6.0.html

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.