Jump to content

drop down select


adzie

Recommended Posts

hi guys

 

I am working on a small script to load all members names into a drop down list, this I have acheived so far.

 

What i'm looking to do is make this so that when I select a name from the list I have a submit button which opens up a member edit form which I have created.

 

Below is where I'm at so far.

 

Thanks for any help

 

<?php

 

//Connect to db

 

include("connectdb.php");

 

$query = "SELECT name FROM members";

$result = mysql_query($query);

 

 

echo "<select name=\"names\">\n";

while($row = mysql_fetch_array($result))

echo "<option name=\"".$row['name']."\">".$row['name']."</option>\n";

 

$name=$row = mysql_fetch_array($result);

 

 

 

?>

Link to comment
https://forums.phpfreaks.com/topic/64895-drop-down-select/
Share on other sites

sorry

 

What I have so far is a drop down box of the members in my sql DB

 

what i'd like to do it set it so that when I select a member from the list and click submit it opens another form with that members details.

 

I have the other form created I just need to work out how to select a field and submit it

Link to comment
https://forums.phpfreaks.com/topic/64895-drop-down-select/#findComment-323784
Share on other sites

Since I don't see a form tag I assume that is what you need.

<form method=GET action="memberedit.php">

 

You can use GET or POST, doesn't matter.

 

You will also need a submit button:

<input type=submit value="edit">
</form> //close form tag, of course.

 

After you have this code in that page, on your member edit page, you can access what was in the list with the post array: $_POST['names'].

Link to comment
https://forums.phpfreaks.com/topic/64895-drop-down-select/#findComment-323788
Share on other sites

I've edited thus far, can anyone point me in the right direction?

 

 

<?php

 

//Connect to db

 

$_POST['name'].

 

include("connectdb.php");

 

$query = "SELECT name FROM pilots";

$result = mysql_query($query);

 

echo "<select name=\"names\">\n";

while($row = mysql_fetch_array($result))

echo "<option name=\"".$row['name']."\">".$row['name']."</option>\n";

 

 

 

 

?>

<table width="300" cellpadding="10" cellspacing="0" border="2">

<tr align="center" valign="top">

<td align="center" colspan="1" rowspan="1" bgcolor="#64b1ff">

<h3>Edit and Submit</h3>

<form action="change_record.php" method="post">

<input type="Submit" value="Update">

</form> Click Here to acces that members File

</td></tr></table>

 

Link to comment
https://forums.phpfreaks.com/topic/64895-drop-down-select/#findComment-323830
Share on other sites

  • 2 weeks later...

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.