Jump to content

pobman

New Members
  • Posts

    8
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

pobman's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I have been going over the script and realised I had a few configuration errors. I have now made the changes to what I think is all the correct places but the results in the drop down box is still empty except the "-" value. Can you suggest some other changes I need to make. thanks if(isset($_GET['server']) && !empty($_GET['server'])) { $server = $_GET['server']; // now, as you see, we have in $server the value selected in dropdown list // so, we can do our query now: // this query is an example, you can modify $cn_server = mysql_query("SELECT * FROM CES WHERE Name ='".$server."'"); //.. } ?> <form action="" onsubmit="return validateForm();"> Choose a Server: <select name="myServers" id="myServers" onchange="selectMyServer(this.value);"> <option value="-">-</option> <?php $cn = mysql_query("SELECT * FROM `CES` WHERE `Name` IS NOT NULL"); echo "SOME TEXT"; while($rs = mysql_fetch_array($cn)) echo "<option value='{$rs['Name']}'> {$rs['Name']}</option>"; { ?> <option value="<?php echo $rs['Name']; ?>"><?php echo $rs['Name']; ?></option> <?php } ?> </select> <br /> <br /> <input type="submit" value="Send Data" /> </form>
  2. Hi jacsdev, Thanks for your post. I have made the changes to your script as follows for the sql querys: if(isset($_GET['server']) && !empty($_GET['server'])) { $server = $_GET['server']; // now, as you see, we have in $server the value selected in dropdown list // so, we can do our query now: // this query is an example, you can modify $cn_server = mysql_query("SELECT * FROM CES WHERE Name ='".$server."'"); //.. } ?> <form action="" onsubmit="return validateForm();"> Choose a Server: <select name="myServers" id="myServers" onchange="selectMyServer(this.value);"> <option value="-">-</option> <?php $cn = mysql_query("SELECT * FROM `CES` WHERE `Name` IS NOT NULL"); while($rs = mysql_fetch_array($cn)) { ?> <option value="<?php echo $rs['server_name']; ?>"><?php echo $rs['server_name']; ?></option> <?php } ?> Howver It is not returning a list of the servers in the dropdown box from the "Name" column in "CES" Have I missed out some configuration? Thanks
  3. Thanks for your reply, it would be the submit button I am after, javascript another day. How do I change the code to do this.
  4. Hi, I am very new to php and mysql and want to write a little php app to display data from a DB. with help I have managed to get a dropdown box working using the code below. In the dropdown box I get a list of servers eg "merak" I now want to use this varrible "merak" and run the following query and display it in the page, how do I make this happen. The query was going to be: (straight from phpmyadmin) $sql = 'SELECT `Name`, `Make`, `OS`, `Version` FROM `CES` WHERE `Name` = CONVERT(_utf8 \'merak\' USING latin1) COLLATE latin1_swedish_ci'; My current dropdown script: <form class="table" action="check.php" method="post"> <div class="inner-form"> <div class="msg msg-info"> <p>Please select which server you wish to edit.</p> </div> <? mysql_connect(localhost, root, admin); @mysql_select_db(servers_db) or die( "Unable to select database"); echo "<select name=form>n<option selected>Choose a Server</option>"; $query=mysql_query("SELECT * FROM `CES` WHERE `Name` IS NOT NULL"); while($row = mysql_fetch_array($query)) { echo "<option value='{$row['Server']}'> {$row['Name']}</option>"; //echo "<option value=\"" . $row[server] . "\">" . $row[NAME] . "</option>"; } ?></div> </select> <input type="submit" VALUE="Submit"> </form> Thanks
  5. Thanks all for your advice I really appreciated your responses. Good news is it is working for me so lesson 1 has now been learnt. Next thing is choosing a result from the drop down and using it in a new query, time for a new post!
  6. Thanks for your help it is working now, but you raised a question that had me thinking. I am unsure if the line above is correct even though it does work. The db = server_db table = CES field = Name These are the only varibles in my script, server was there as it was in a posting I read and I used the copy and paste without really understanding the code being used. How should the code be with out the Server varible?
  7. thanks for your reply, I get the dropdown box now but no entries. $query = 'SELECT `Name` FROM `CES` WHERE `Name` IS NOT NULL'; $results = mysql_query($query); while($row = mysql_fetch_array($results)) { echo "<option value=\"" . $row[server] . "\">" . $row[NAME] . "</option>"; Is the code correct for displaying the results in the dropdown box?
  8. Hi, I have just started learning php and mysql, and I'd like to make a dropdown box from a table. I have tried several postings but I can't get them to work so made my own thread. I am getting a blank page so all is not well. so far I have: <form class="table" action="check.php" method="post"> <div class="inner-form"> <div class="msg msg-info"> <p>Please select which domain you wish to edit.</p> </div> <? mysql_connect(localhost, user, pass); @mysql_select_db(servers_db) or die( "Unable to select database"); echo "<select name=form>n<option selected>choose Server</option>"; $query = "select Name, from CES"; while($row = mysql_query($query)) { echo "<option value="" . $row[server] . "">" . $row[NAME] . "</option>" ; } ?></div> </select> <input type="submit" VALUE="Edit"> </form> Thanks
×
×
  • 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.