Jump to content

Having problems with selectbox entry


inbowns

Recommended Posts

I have a select box and I would like to  select data click on it and I guess it should reload the page and populate the text boxes i have below with the data from the database. Below is the code so you can have an idea what i'm trying to do. Is this possible and help would be greatly appreciate.

 

Thanks in advance.

 

<html>
<head>
<meta name="generator" content="PhpED Version 5.9.5 (Build 5989)">
<title> RSVP Administrator</title>
<link rel="shortcut icon"  href="">
</head>
<body>
<fieldset>
<legend>Events</legend>
<table>
      <tr>
      <td>
         Select an address:
      </td>
      <td>
        <SELECT NAME>
         <option value=' '> <? echo $option1 ?>;</option> 
         </SELECT>
      </td>
   </tr>


   <tr>
      <td>
        Place of Event:
      </td>
      <td>
         <input type="text" name="location" value="<?php if($option1 == " "){ echo " ";} else{ echo $address_1;} ?>">
      </td>
   </tr>
   <tr>
      <td>
          Address 1:
      </td>
      <td>
         <input type="text" name="address_1">
      </td>
   </tr>
   <tr>
      <td>
          Address 2:
      </td>
      <td>
         <input type="text" name="address_2">
      </td>
   </tr>
   <tr>
      <td>
         City:
      </td>
      <td>
         <input type="text" name="city">
      </td>
   </tr>
   <tr>
      <td>
         State:
      </td>
      <td>
         <input type="text" name="state">
      </td>
   </tr>
   <tr>
      <td>
        Zip Code:
      </td>
      <td>
         <input type="text" name="zip_code">
      </td>
   </tr>
   <tr>
      <td>
        Telephone:
      </td>
      <td>
         <input type="text" name="phone">
      </td>
   </tr>
     
   
</table>
  </fieldset>

</body>
</html>

 

 

Link to comment
https://forums.phpfreaks.com/topic/236249-having-problems-with-selectbox-entry/
Share on other sites

Put this in your SELECT tag:

 

<SELECT NAME="" onChange="this.form.submit()">

 

Then receive the values with $_POST at the top of the page.  Or I may not understand your question?

 

Something like what you wrote only I need the textboxes to fill in but on on submit when i select something from the select box i would like of the page to refresh and populate the textboxes.

? If you use the [onChange=this.form.submit()] and add the $_POST's to receive the select values, the page will refresh and the text fields will be populated with the matching database values.  This isn't what you want?

 

Sorry but this is not working I'm I missing something?

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.