Jump to content


Drop-down menu problem


1 reply to this topic

#1 The Creator

    Young Padawan

  • Members
  • Pip
  • 115 posts
  • Gender:Male
  • Location:England
  • Interests:Computers, Music, Technology, Sport

Posted 29 May 2007 - 12:29 PM

ok, i want to have one of those dropdown forms that when u update it changes the text on the page without refreshing...

i want to do this by including files in php, but using JS...

dont get what i mean? heres the code:

<script>


function liveForm(form){
document.getElementById("formText").innerHTML = "<?php include 'set/text/" + form + ".php'; ?>"
}

</script>

thats the js...

heres the form:


<form name="donatedrop" method="post" onChange="java script:lifeForm()">
  <select name="select">
	<option value="regdon">Regular donations by Direct Debit</option>
	<option value="oneoff">One-off donation by Credit Card</option>
	<option value="bequest">Make a bequest</option>
	<option value="giftaid">Gift Aid</option>
	<option value="member">Become a Member</option>
	<option value="check">Write Check</option>
	<option value="bankord">Regular Banker's Order</option>
  </select>
</form>

<div id="formText">

</div>

now could someone tell me why it doesnt work?

cheers!

Joe

#2 Demonslay

    P2L Jedi

  • Members
  • PipPipPip
  • 970 posts
  • Gender:Male
  • Location:A strange world where water falls out of the sky... for no reason.
  • Interests:Graphic Design, Coding, Splinter Cell, Cats

Posted 29 May 2007 - 07:42 PM

Please use the form search.

And also, why do people try to use PHP together with JavaScript like this?

Look up tutorials about AJAX, and for using PHP with JavaScript.

PHP is parsed before it is sent to the user, JS is parsed and executed with the client browser.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users