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

A list box that changes what HTML is displayed.

I first should list my background and that is that I'm new to PHP.
I would like to be able to have an HTML form where there is a list
that you choose from. Depending on what item is chosen in the list
different HTML is displayed somewhere else on the page. I know this
might be possible by adding a submit button and reloading the page.
But is there a way to do it without the submit button?

I know that Java might be able to accomplish this where depending on
what is selected it changes what is displayed but what is possible
from PHP? I know the page may need to be reloaded with the new data.
But can that be done without the submit button? Maybe there's even a
way of avoiding reloading the page to change the HTML? Even if I have
to reload the page can it be done without the submit button?

Thanks for your help. :)
Chad.
Jun 27 '08 #1
10 1373
<ch*****************@yahoo.comwrote in message
news:9a**********************************@79g2000h sk.googlegroups.com...
I first should list my background and that is that I'm new to PHP.
I would like to be able to have an HTML form where there is a list
that you choose from. Depending on what item is chosen in the list
different HTML is displayed somewhere else on the page. I know this
might be possible by adding a submit button and reloading the page.
But is there a way to do it without the submit button?

I know that Java might be able to accomplish this where depending on
what is selected it changes what is displayed but what is possible
from PHP? I know the page may need to be reloaded with the new data.
But can that be done without the submit button? Maybe there's even a
way of avoiding reloading the page to change the HTML? Even if I have
to reload the page can it be done without the submit button?

Thanks for your help. :)
Chad.
Your questions seem to point toward AJAX.
You can combine JavaScript and php to create dynamic content.
Google AJAX.
Vince
Jun 27 '08 #2
On 26 Jun, 09:52, chadsspameaterem...@yahoo.com wrote:
I first should list my background and that is that I'm new to PHP.
I would like to be able to have an HTML form where there is a list
that you choose from. *Depending on what item is chosen in the list
different HTML is displayed somewhere else on the page. *I know this
might be possible by adding a submit button and reloading the page.
But is there a way to do it without the submit button?

I know that Java might be able to accomplish this where depending on
what is selected it changes what is displayed but what is possible
from PHP? *I know the page may need to be reloaded with the new data.
But can that be done without the submit button? *Maybe there's even a
way of avoiding reloading the page to change the HTML? *Even if I have
to reload the page can it be done without the submit button?

Thanks for your help. :)
Chad.
Rather than Java, I think you mean javascript. All the questions that
you are asking are client side ones. The place to ask this is
certainly in a javascript newsghroup.
However, since there is already so much information out there about
how to do this, I would urge you to search on Google first.
Jun 27 '08 #3
ch*****************@yahoo.com wrote:
I first should list my background and that is that I'm new to PHP.
I would like to be able to have an HTML form where there is a list
that you choose from. Depending on what item is chosen in the list
different HTML is displayed somewhere else on the page. I know this
might be possible by adding a submit button and reloading the page.
But is there a way to do it without the submit button?
Only with some javascript, and possibly something like Ajax as well.

I.e. you cannot alter what is on a page without client side
intelligence, or reloading some or all o the info, or both.

I know that Java might be able to accomplish this where depending on
what is selected it changes what is displayed but what is possible
from PHP? I know the page may need to be reloaded with the new data.
But can that be done without the submit button?
Yes, but only by using javascript to invoke a 'submit()' type function.
Maybe there's even a
way of avoiding reloading the page to change the HTML? Even if I have
to reload the page can it be done without the submit button?
The submit button is really he lest of your worries. As I said
javascript of teh most minimal can get riond that.

A lot depeds on how much informatin teh modified pages reprsent: if its
not too much and its all text, redarwing with javascript alone using
stuff 'made invisible' layerd ver and under visible stuff is not too hard.

If however the possibilities are pretty large, then you want to reload
some or all of the page dynamically: I believe ajax is the way to go
here,but have no idea exactly how it works.

Or just reload the WHOLE page.
Thanks for your help. :)
Chad.
Jun 27 '08 #4
ch*****************@yahoo.com escribió:
I first should list my background and that is that I'm new to PHP.
I would like to be able to have an HTML form where there is a list
that you choose from. Depending on what item is chosen in the list
different HTML is displayed somewhere else on the page. I know this
might be possible by adding a submit button and reloading the page.
But is there a way to do it without the submit button?
Not with PHP. And the fact that you're even asking shows that you don't
really understand how PHP works. PHP runs on the web server and once the
output of the script is sent to the browser, PHP is done: it can't reach
the client computer and change anything there.

I know that Java might be able to accomplish this where depending on
what is selected it changes what is displayed but what is possible
from PHP?
A Java applet? Trust me, you don't want to mess with that. But it'd be
very simple with some JavaScript ;-)
I know the page may need to be reloaded with the new data.
That depends on how large and variable the data is:

- If you only want to, let's say, display different invoice options
depending on the answer to "Personal / Enterprise", you can load
everything and use JavaScript to change the "display" CSS attribute.

- If you want to display cities depending on the country, well,
preloading all the cities in the world may result in a 10MB document,
thus you need AJAX (the J in AJAX is for JavaScript).
--
-- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web: http://bits.demogracia.com
-- Mi web de humor al baño María: http://www.demogracia.com
--
Jun 27 '08 #5
On Thu, 26 Jun 2008 01:52:09 -0700, <ch*****************@yahoo.comwrote:
I first should list my background and that is that I'm new to PHP.
I would like to be able to have an HTML form where there is a list
that you choose from. Depending on what item is chosen in the list
different HTML is displayed somewhere else on the page. I know this
might be possible by adding a submit button and reloading the page.
But is there a way to do it without the submit button?
You can simply have the list submit to a PHP script, where each option
sends a different value. Depending on the value, you have the appropriate
content display. To have the list submit when someone selects an option,
see the onchange event handler for JavaScript. Also, search for the forms
object.
I know that Java might be able to accomplish this where depending on
what is selected it changes what is displayed but what is possible
from PHP? I know the page may need to be reloaded with the new data.
But can that be done without the submit button? Maybe there's even a
way of avoiding reloading the page to change the HTML? Even if I have
to reload the page can it be done without the submit button?
You mean JavaScript, not Java. Making content avaialbe by means of JS
alone is a bad idea, as many people may not have JS activated. Also, it
doesn't even sound like you need Ajax, just the DOM objects in JS. You'll
need to do quite a bit of researching on how to code JavaScript.
Thanks for your help. :)
Chad.
--
Curtis, http://dyersweb.com
Jun 27 '08 #6
>>I know the page may need to be reloaded with the new data.
>But can that be done without the submit button?

Yes, but only by using javascript to invoke a 'submit()' type function.
Well darn! I was figuring if a button can make "submit" behavior
happen that maybe a list might be able to cause "submit" behavior to
occur as well when a selection occurs. :-(

Jun 27 '08 #7
On Thu, 26 Jun 2008 13:31:27 -0700, <ch*****************@yahoo.comwrote:
>>I know the page may need to be reloaded with the new data.
But can that be done without the submit button?

Yes, but only by using javascript to invoke a 'submit()' type function.

Well darn! I was figuring if a button can make "submit" behavior
happen that maybe a list might be able to cause "submit" behavior to
occur as well when a selection occurs. :-(
It can, google the onchange event handler for JavaScript.

--
Curtis, http://dyersweb.com
Jun 27 '08 #8
<ch*****************@yahoo.comwrote in message
news:12**********************************@34g2000h sf.googlegroups.com...
>I know the page may need to be reloaded with the new data.
But can that be done without the submit button?
Yes, but only by using javascript to invoke a 'submit()' type function.

Well darn! I was figuring if a button can make "submit" behavior
happen that maybe a list might be able to cause "submit" behavior to
occur as well when a selection occurs. :-(
As Curtis has pointed out, you can, and it's not that hard to do at all.
Google AJAX....
Vince
Jun 27 '08 #9
On Jun 27, 6:41*am, "Vince Morgan" <vinharAtHereoptusnet.com.au>
wrote:
<chadsspameaterem...@yahoo.comwrote in message

news:12**********************************@34g2000h sf.googlegroups.com...>>>I know the page may need to be reloaded with the new data.
>But can that be done without the submit button?
>Yes, but only by using javascript to invoke a 'submit()' type function..
Well darn! *I was figuring if a button can make "submit" behavior
happen that maybe a list might be able to cause "submit" behavior to
occur as well when a selection occurs. :-(

As Curtis has pointed out, you can, and it's not that hard to do at all.
Google AJAX....
Vince
Try this link:
http://satya61229.blogspot.com/2007/...t-list-by.html
Jun 27 '08 #10
..oO(ch*****************@yahoo.com)
>>>I know the page may need to be reloaded with the new data.
But can that be done without the submit button?

Yes, but only by using javascript to invoke a 'submit()' type function.

Well darn! I was figuring if a button can make "submit" behavior
happen that maybe a list might be able to cause "submit" behavior to
occur as well when a selection occurs. :-(
That's not what a list is for. It's meant to select something, not to
trigger an action.

Micha
Jun 27 '08 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Michel | last post by:
I have an html page which, thanks to some javascript, allows to move pieces on a chessboard. I can't find how to reflect the moves in a list displayed by the same page. To understand what I'm...
4
by: Gurry | last post by:
Hi there I would like to write a javascript function that creates a drop-down list dynamically. I read on the docs that most HTML controls can not be created on run-time. what kind of...
6
by: Stan Brown | last post by:
http://www.acad.sunytccc.edu/instruct/sbrown/stat15/demo.htm http://www.acad.sunytccc.edu/instruct/sbrown/npscreen.css The first table is floated right (class="fr"). Text does not flow around...
2
by: Wysiwyg | last post by:
I was hoping to get some opinions on the efficiency of various methods of reusing the same dropdown list data. Here is the situation: Multiple panels on maintenance pages with TAB menus across...
3
by: pmud | last post by:
Hi, I have a drop down list bound to a database thorugh a data reader. It reads the customer names from data reader. Now, I want the user to be able to type more than one alphabet & the list...
7
by: David Freeman | last post by:
Hi There! I'm trying to create a User Registration page in ASP.NET and wondering what is the best way to get the list of up-to-date Countries and Cities? Are there any Web Services on the web...
10
by: Hank1234 | last post by:
I am having a problem with a list box on a form. I have a list box that when I add items to it the text does not show up in the list box. I know thy are added because the side scroll bar changes...
1
by: Stephen Plotnick | last post by:
My understanding of data binding means that when a user changes a value on the screen it actaully changes the value in an Access table. If this is true here is what I want to do: Threee field...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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.