View Full Version : Simple PHP Question

03-13-2008, 07:02 PM

I'm trying to find a way to have a dropdown menu, and depending on your selection a different paragraph of information will appear on the screen.

I'm pretty sure PHP would accomplish this.

If it isn't simple enough to just explain, I would appreciate any helpful literature you can offer.


03-13-2008, 07:04 PM
It could accomplish this however the page would require a page refresh but some how I don't think you wanted that.

03-13-2008, 07:07 PM
Well, no, not really--I was hoping for something a little more fluid.

Any suggestions on how else to accomplish this if PHP isn't what I was looking for? The easier the better.

03-13-2008, 07:12 PM
AJAX? (http://google.com/search?q=ajax+menus)

03-13-2008, 07:23 PM
AJAX seems to be, and correct me if I'm wrong, fancy dropdown menus. And, although it's very cool (I've bookmarked it, as I have no doubt I'll need it someday), I'm not really interested in the dropdown menu--I just want a way for, when something is selected from a simple dropdown, information appears below it without a refresh. I'm pretty sure I've seen this done.

Besides, nothing is impossible with the intar-web.

EDIT: And, to be clear, when I see information to appear below it I don't mean a drop down menu. What the dropdown menu LINKS to IS the paragraph of information that appears below it. Does that make sense?

03-13-2008, 08:16 PM
theres more to ajax than drop down menu's do some homework.

03-13-2008, 08:20 PM
Kyle ... how about <iframe> inline frame?

Now, don't everyone jump on me about <iframe>...
I think it's a good solution in his case.

Your link targets the <iframe> ...

<a href='paragraph.html' target='frame1'>view paragraph</a>

Then, define the <iframe> where you want it to be and the size, etc...

<iframe name='frame1' src='default.html' frameborder='0' scrolling='no' width='400' height='400'></iframe>

It will put the contents of "paragraph.html" into the <iframe>

03-25-2008, 08:25 PM
Thank you very much. The iframe idea was perfect.

Much appreciated.

03-26-2008, 06:16 AM
Since you asked about a drop down I would think that a simple javascript would be a better solution in this case.
Something like this:

<script type="text/javascript">
function changeptext(){
var box=document.getElementById('selectbox');
var othertext=document.getElementById('paragraph');

if(box.value == 'a' ){
othertext.innerHTML = 'This is the text for Selected A';
else if(box.value == 'b' ){
othertext.innerHTML = 'This is the text for Selected B';
else if(box.value == 'c' ){
othertext.innerHTML = 'This is the text for Selected C';
othertext.innerHTML = 'Select a value from the dropdown to get more info';


<select name="any" onchange="changeptext()" id="selectbox">
<option value="">SELECT SOMETHING</option>
<option value="a">A</option>
<option value="b">B</option>
<option value="c">C</option>
<div style="width:200px;background:#E8E8E8" id="paragraph">
Select a value from the dropdown to get more info

That way you :
A) Wouldn't Need to Create a seperate page for each paragraph
B) You could easily add the javascript with a php loop to create the paragraph info if you are pulling that from a db.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum