Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Object Required when posting to database

Status
Not open for further replies.

bobbyrabbit

Technical User
May 23, 2005
10
GB
I'm trying to post to 2 fields in the MySQL Database:

I'm generating data from fields DocTitle and DocCost in table 'worktype' in a dropdown box which is working fine. I am trying to post this info to another table 'bidrequests' using the same field names when submitting the form. I think the problem is that I'm trying to post more than 1 peice of info via the form. The data to upload is part of an Applet. On clicking the submit button I am getting javascript error Object Required. Here is the code, thanks for any help:



document.InterfaceApplet.SETPARAMETER ("DocTitle", document.getElementById("WorkType").value);
document.InterfaceApplet.SETPARAMETER ("DocCost", document.getElementById("WorkType").value);

-------------------------------------------------------------------------------

<select name="WorkType" id="select">
<?php
$selected = "";
do {
if (isset($_POST['WorkType']) && $row_rsDocTitle['DocTitle']==$_POST['WorkType'])
$selected = "select";
else
$selected = "";
?>
<option value="<?php echo $row_rsDocTitle['DocTitle']?><?php echo $row_rsDocTitle['DocCost']?>" <?php echo $selected; ?>><?php echo $row_rsDocTitle['DocTitle']?>
- <?=$CurrencySymbol?><?php echo $row_rsDocTitle['DocCost']?></option>
<?php
} while ($row_rsDocTitle = mysql_fetch_assoc($rsDocTitle));
$rows = mysql_num_rows($rsDocTitle);
if($rows > 0) {
mysql_data_seek($rsDocTitle, 0);
$row_rsDocTitle = mysql_fetch_assoc($rsDocTitle);
}
?>
</select>
 
On the surface, should it not be this?
[tt] document.InterfaceApplet.SETPARAMETER ("DocTitle", document.getElementById("[red]select[/red]").value); [/tt]
Or, if you like, this?
[tt] document.InterfaceApplet.SETPARAMETER ("DocTitle", document.getElement[blue]s[/blue]By[blue]Name[/blue]("WorkType")[blue][0][/blue].value); [/tt]

 
Top statement was about correct. Name and ID have to be the same. Many thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top