473,388 Members | 1,340 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

Dynamic List menu with mysql_fetch_assoc

i want to fetch the students numbers from my database using mysql_fetch to a combo box created in my html. please help me
Sep 18 '07 #1
9 5628
ak1dnar
1,584 Expert 1GB
Check this out:

Expand|Select|Wrap|Line Numbers
  1. // I think you know how to code rest of the lines
  2. while ($row = mysql_fetch_assoc($result)){
  3.     $studentId .= '<option value="' . $row['student_id'] . '"' ;
  4.     $studentId .= '>' . $row['student_id'] . '</option>';    
  5. }
  6. <select name="student_id" id="student_id">
  7.         <option value="">--Student IDs--</option>
  8.         <?php echo $studentId; ?> 
  9. </select>
  10.  
  11.  
Welcome to theScripts!
Sep 18 '07 #2
Ajm113
161 100+
Iframe is your friend!

http://www.w3schools.com/html/tryit....tryhtml_iframe

Just use that code with the page you are using to get user information and you can place the iframe on your wedge or have the widget in your iframe.

Its pretty useful!
Sep 18 '07 #3
ak1dnar
1,584 Expert 1GB
Iframe is your friend!

http://www.w3schools.com/html/tryit....tryhtml_iframe

Just use that code with the page you are using to get user information and you can place the iframe on your wedge or have the widget in your iframe.

Its pretty useful!
Iframes why? Still there are lots of easy ways to do the job. Please refer to my previous post. Thanks a lot !
Sep 18 '07 #4
ak1dnar
1,584 Expert 1GB
[please reply me] Thread title changed to suite with its contents.Thanks.
Please use good thread titles always. read the Site FAQ section for more details.
Sep 18 '07 #5
Ajm113
161 100+
Oh I thought he meant combo box as in a like those ad junk you can add to your site that displays information! Sorry its like 12 A.M where I live.
Sep 18 '07 #6
ak1dnar
1,584 Expert 1GB
Oh I thought he meant combo box as in a like those ad junk you can add to your site that displays information! Sorry its like 12 A.M where I live.
No Problem Ajm. I'll ask him/her to read the Posting Guidelines before the next post.
Sep 18 '07 #7
when i select the student id
the corresponding details of the students should be listed in the test box given
for example
i have given my code down

do help me to solve my problem
[php]
<html>
<head><title>information</title>
</head>
<body>
<form name="input" action="link1.php" method="post">
<table align="center" bgcolor="#eeeeee" border="0" cellpadding="10" cellspacing="10" width="100%">
<tr><td>
No:
<?php
$opt1 = '';
$bb = mysql_query("SELECT * FROM details ");
while ($val = mysql_fetch_array($bb)) {
$opt1 .= "<option value='$val[0]'>$val[0]</option>";
$pr =$val[0];
print_r($pre);
}
?>
<select name="sno"> <?=$opt1?>" ></select>
</td>
</tr>
<tr><td>
Name:
<input type="text" id ='$val->number'readonly='true'name="sstd" value="">
</td>
</tr>
<tr><td>
Standard:
<input type="text" readonly='true'name="sstd" value="">
<br>
</td>
</tr>
<tr><td>
English:
<input type="text" readonly='true'name="seng" value="">
<br>
<br>
</td>
</tr>
<tr><td>
Maths:
<input type="text" readonly='true'name="smath" value="">
<br>
</td>
</tr>
<tr><td>
Science:
<input type="text" readonly='true'name="ssci" value="">
<br>
</td>
</tr>
<tr><td>
Social Science:
<input type="text" readonly='true'name="sss" value="">
<br>
</td>
</tr>
</table>
</form>
<form name="input" action="" method="post">
<a href = "addlink.php">ADD</a>
&nbsp &nbsp
<a href = "viewlink.php">VIEW </a>
&nbsp &nbsp
<a href = "deletelink.php">DELETE </a>
&nbsp &nbsp
<a href = "link4.php">EDIT </a>
</form>
</body>
</html>
[/php]
thanks a mile in advance
Sep 19 '07 #8
ronverdonk
4,258 Expert 4TB
Next time use code tags to enclose your script code. See the reply guidelines at the right of your reply screen.

moderator
Sep 19 '07 #9
kovik
1,044 Expert 1GB
We're not going to do it for you.

BTW, why do you have a quotation mark and a closing tag after you echo $opt1?

EDIT: Did this thread *just* get merged?
Sep 19 '07 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Angelos | last post by:
Hello there... I am trying for a long time now, to find a way of creating a dynamic drop down menu. I have the CSS part ready and working and also I have the first level of the menu working. the...
1
by: Nathan Bloomfield | last post by:
Does anyone know if there is any documentation which relates to Access2k + ? or can anyone help adjust the code? I am having trouble converting the DAO references. TITLE :INF: How to...
4
by: snowweb | last post by:
I am trying to implement a CSS hierarchical unfolding menu on a site. The thing is, it needs to be dynamically populated from the results of a database query. I previously had the menu working but...
19
by: mart2006 | last post by:
I've created a dynamic drop down menu that populates itself with data from a MySQL table. What I would like to do is create a non dynamic drop down menu that alters what is shown in the dynamic menu....
6
by: hardik | last post by:
hi friends i am very new to java script.if anyone can help me out then i will be thankful. i am using php and mysql in my learning project and i have two list boxes,now whenever user presses...
4
by: cctxman1942 | last post by:
Here is what I have done: Created a page with a drop down menu listing names of builders retrieved from a mysql database containing contact info for client builders. What I need to do, and so far...
0
by: benfly08 | last post by:
Hi, I used SWT to develop an windows application. In the application there is a dynamic created popup menu. The dynamic part is that i will pass a list of name to be a submenu of one menu item....
2
by: vinceboy | last post by:
Hi anybody. I am newbie here and would like to know that how can I validate both drop down menu and radio button from a dynamic display form.Something went wrong with my script.The radio button is...
3
by: jaddi1 | last post by:
Hi, I am trying to make a multi-level drop-down menu similar to what is seen here: http://www.cssplay.co.uk/menus/simple_vertical.html. My problem is that some of the menu will be populated from...
10
by: mart2006 | last post by:
Hi, I'm fairly new to PHP and I've created a dynamic drop down menu that populates itself with data from a MySQL table. What I would like to do is create a non dynamic drop down menu that alters...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.