Jump to content

josephpruski

New Members
  • Posts

    1
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

josephpruski's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I've banged my head against the wall on this for the past few days finally reaching this point... I've created a drop down menu that can now sucsessfully return a string of values from a MySQL database. I'm wanting to dynamically update multiple text boxes with each part of data when entering a form. (Simple terms... User selects a "Venue" from the dropdown, and the text boxes below automatically display the "Venue"'s information in each box (Address, Address2, City, State, etc...) So right now, when the drop down menu is selected, I can't get the string to separate and give each (substring?) an ID to show in separate text boxes. I know I'm halfway there because I can go back to the basics and leave the return string alone and sucsessfully show up in a single text box with the separator between each piece of data from the database. (i.e.: Venue_ID/Venue_Name/Venue_City/etc.) Any thoughts? Jokes? Code Help? Here's the basic code I'm using... Java: function getVenueInfo(strURL) { var req = getXMLHTTP(); if (req) { //function to be called when state is changed req.onreadystatechange = function() { //when state is completed i.e 4 if (req.readyState == 4) { // only if http status is "OK" if (req.status == 200) { document.getElementById('venue_id').value=req.responseText; } else { alert("There was a problem while using XMLHTTP:\n" + req.statusText); } } } req.open("GET", strURL, true); req.send(null); } } PHP: $sql="SELECT * FROM Q_Venues WHERE Venue_ID = '".$venue."'"; $result = mysql_query($sql); while($row = mysql_fetch_array($result)) { echo $row['Venue_ID']; echo "/"; echo $row['Venue_Name']; echo "/"; echo $row['Venue_City']; } ?> Body Code: <p>Venue : <select name="venue" onChange="getVenueInfo('find_ccode.php?venue='+this.value)"> <option value="">Select Venue</option> <?php do { ?> <option value="<?php echo $row_Venues['Venue_ID']?>"><?php echo $row_Venues['Venue_Name']?></option> <?php } while ($row_Venues = mysql_fetch_assoc($Venues)); $rows = mysql_num_rows($Venues); if($rows > 0) { mysql_data_seek($Venues, 0); $row_Venues = mysql_fetch_assoc($Venues); } ?> </select><br/> <br/> ID : <input type="text" name="venue_id" id="venue_id" > <br/> Name : <input type="text" name="ven_2" id="ven_2" > //Where I'm wanting the "Venue Name" <br/> City : <input type="text" name="ven_3" id="ven_3" > //Where I'm wanting the "Venue City" </form> And so forth... Thanks for any help. After lots of researching I'm learning that most of you guru's are probably sick of seeing these, but I'm a newbie on a mission...
×
×
  • 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.