473,402 Members | 2,053 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,402 software developers and data experts.

Show new list box when option selected from select box

I have the following code :

[PHP]$form = "<head><title>:::Subjects:::</title></head>
<script src='ajax_files/prototype.js'></script>
<script src='ajax_files/getSecond.js'></script>
<body>
<form action='subjects.php' method='get' enctype='multipart/form-data'>
<table width='394' border='1' align='center' cellpadding='5' cellspacing='5'>
<tr>
<td>Programe Name:</td>";

$sql = "select programe_name from programmes";
$result = mysql_query($sql, $conn) or die (mysql_error());
while ($row = mysql_fetch_array($result)){
$add .="<option value='$row[programe_name]'>$row[programe_name]</option>";
}

$form .= "<td>
<select name='prog_name' id='prog_name' onchange='getSecond(this.value)'>
<option value=''>--Select--</option>
$add
</select>
</td>
</tr>
<tr>
<td>Semester:</td>
<td><span id=\"comboHint\">";

$include = include('ajax_files/sublist.php'); // i don't know wat to do here? How to include this file?
// include "ajax_files/sublist.php";

$form .= "$include</span>
</td></tr></table></form></body></html>";[/PHP]

I am actually getting the programe names from the table inside the select box.
Now i want whenever a programe name is selected, for e,g bba, a new list box should appear with the total no of semesters for it.
i dont know how to put the sublist.php file between <span> </span> tags and run it there.
In the sublist.php file i have my list box.

And another question is, how can i maintain the format/design of my form?
because when i echo the file sublist.php it is showing me the list box on the top left corner instead of inside the cell, which i have mentioned.
Oct 24 '07 #1
2 2551
acoder
16,027 Expert Mod 8TB
Welcome to TSDN!

I have changed the thread title to give it a better description and make it easier for others with similar problems to find it.

What you want to do requires Ajax, but Ajax works by loading an initial page. Then a request is made to a server-side script (sublist.php) with the required parameters/arguments. This returns a response which you can use to modify/populate the page.

See an Ajax example.
Oct 25 '07 #2
Welcome to TSDN!

What you want to do requires Ajax, but Ajax works by loading an initial page. Then a request is made to a server-side script (sublist.php) with the required parameters/arguments. This returns a response which you can use to modify/populate the page.

See an Ajax example.
Thankyou very much for the link.
By the way i am using ajax, and prototype.js library.
Oct 25 '07 #3

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

Similar topics

7
by: deko | last post by:
I populate a drop-down list like this: echo "<select>"; foreach ( $ip_list as $var ) { echo "<option>"; echo $var; echo "</option>"; } echo "</select>";
4
by: devine | last post by:
Hi All, I am VERY new to Javascript. I have been provided with some code, which will enable me to hide/show a text area and change a submit button dependant on a check box. <!DOCTYPE html...
1
by: Stephene | last post by:
New to the world of web design/php/mysql and need help please. What I'm trying to do: I would like a web page with three drop down menus each populated by a query The first represents...
1
by: skyson2ye | last post by:
Hi, guys: I have written a piece of code which utilizes Javascript in PHP to create a three level dynamic list box(Country, States/Province, Market). However, I have encountered a strange problem,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.