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
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
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
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
Share on other sites

  • 2 weeks later...
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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