i am trying to submit three forms with the one button using javascript.

here is my code

<script type="text/JavaScript">

function submitForms(){
document.dropdown.submit();
document.radio.submit();
document.form.submit();
}

 function textLimit(field, maxlen) {
if (field.value.length > maxlen + 1)
alert('your input has been truncated!');
if (field.value.length > maxlen)
field.value = field.value.substring(0, maxlen);
} 

</script>
</head>

<body>
<form name="dropdown" action="insert.php" method="POST">
<select name="dropdown">
<option value="constructiondb">Construction</option>
<option value="electricaldb">Electrical</option>
<option value="technicaldb">Technical</option>
</select>
</form>
<br />
<form name="radio" action="insert.php" method="POST">
	News Section::<br />
	General News:<input type="radio" value="General News" name="general"><br />
	Internal News:<input type="radio" value="Internal News" name="internal"><br />
</form>
<br />
<form name="form" action="insert.php" method="POST">
	Date:&nbsp;<input type="text" name="date" /><br /><br>
	Title:&nbsp;&nbsp;<input type="text" name="title" /><br /><br />
	Article:<br /><textarea cols="50" rows="10" name="article" onkeyup="textLimit(this, 500);"></textarea><br />
</form>
<input type="button" onclick="submitForms()" value="Submit">

the data which i want to send to the next page does not seem to being passed over though. when i try to echo out the variables nothing is being printed on the page.

any help would be great

Recommended Answers

All 2 Replies

what is the need to put three forms here...

there was no need i was just being stupid i have sorted it out now. thanks for the reply anyway

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.