corsasport.co.uk
 

Corsa Sport » Message Board » Off Day » Geek Day » Anyone know anything about Java Script/HTML


New Topic

New Poll
  Subscribe | Add to Favourites

You are not logged in and may not post or reply to messages. Please log in or create a new account or mail us about fixing an existing one - register@corsasport.co.uk

There are also many more features available when you are logged in such as private messages, buddy list, location services, post search and more.


Author Anyone know anything about Java Script/HTML
ed
Member

Registered: 10th Sep 03
User status: Offline
14th Feb 04 at 17:28   View User's Profile U2U Member Reply With Quote

I'm doing a website in PHP. I got a drop down menu at the top of a page at the moment that you select an option from to query the MySQL database. BUT to get anything to apear on the page you have to press the submit button as the query works on a form variable. Does anyone know how to get a form to submit automaticaly when a page loads. I think it would use the onLoad = tag in java script but I cant figure anything out! Does anyone on here know anything about this sorta thing??? Thanks for any help ED
Dom
Member

Registered: 13th Sep 03
User status: Offline
14th Feb 04 at 17:41   View User's Profile U2U Member Reply With Quote

basically, you want the drop down menu to automatically sumbit when the user selects an options? if so, then its a case of wacking a 'onchange' within the drop down menu tag and put some javascript in it ive forgotten how to do it (just had a play, but cant get it to work) so have a look on google mate, but its something along he lines of 'document.*formname*.submit'
ed
Member

Registered: 10th Sep 03
User status: Offline
14th Feb 04 at 17:48   View User's Profile U2U Member Reply With Quote

I used onChange on a different site somewhere, so i'll have a look it how I did that. Will that submit the form when the page loads though?
Dom
Member

Registered: 13th Sep 03
User status: Offline
14th Feb 04 at 18:07   View User's Profile U2U Member Reply With Quote

no that will submit when the user changes the options in the drop down menu
Although if you want the page to submit when the it loads, then wack a 'onLoad; in the body tag, with the submit javascript and that will do it But why the hell you want to submit a page when its loads though the reason you submit data is to get user input (change of data etc).
Best bet mate is to create the whole page in php, so it first loads up the options menu - user selects option (form points to that php page eg: page.php) and it submits. Using flags (data kept in hidden form variables), the php script will know that the user has selected an option, get the data, and then throw out another screen with the selected options menu and the data below it etc and you reset the flag.
ed
Member

Registered: 10th Sep 03
User status: Offline
14th Feb 04 at 18:09   View User's Profile U2U Member Reply With Quote

Yea that makes more sense than what I'm trying to do! (My first PHP/MySQL site, so i'm getting a bit confused by it all )
Joff
Member

Registered: 17th Oct 00
Location: Cambridgeshire
User status: Offline
14th Feb 04 at 18:13   View User's Profile U2U Member Reply With Quote

code:

<form method="post" name="myForm" action="submit.php">
<select name="selOption" onChange="document.myForm.submit();">
<option value="1">Option 1</option>
<option value="2">Option 2</option>
<option value="3">Option 3</option>
</select>
</form>

Joff
Member

Registered: 17th Oct 00
Location: Cambridgeshire
User status: Offline
14th Feb 04 at 18:16   View User's Profile U2U Member Reply With Quote

Oops - just re-read your first post..


code:

<html>
<head><title>Somepage</title></head>
<body onLoad="document.myForm.submit()">

<form method="post" name="myForm" action="submit.php">
<input type="hidden" value="somevalue" name="txtValue">
</form>

</body>
</html>






[Edited on 14-02-2004 by Joff]

 
New Topic

New Poll

  Related Threads Author Forum Replies Views Last Post
Fao Ian/Tim GT4Brody General Chat 13 789
25th Apr 03 at 13:45
by Sam
 
Java Programmers bert@dsl.pipex.com General Chat 3 757
1st May 03 at 16:25
by someone
 
Does anyone know Java???? SteveW Geek Day 24 1966
9th Jun 03 at 11:50
by Mikorsa16v
 
www.corsa-site.co.uk Steve General Chat 30 1468
11th Jun 03 at 16:19
by Ojc
 
help computer boffs groom Geek Day 33 2942
13th Nov 03 at 21:00
by Tim
 

Corsa Sport » Message Board » Off Day » Geek Day » Anyone know anything about Java Script/HTML 29 database queries in 0.0158720 seconds