Jump to content

Object expected problem!!!


Recommended Posts

Hi Ya olMy php file (myfile.php) includes an html input type tags with button that will 'onclick' to a javascript function. my problem heaps is i get object expected error! this is an excerpt of my file: .....<select name="select" id="reasons"> <?php do { ?> <option value = "<?php echo $reasonrows['txreasonid']; ?> "><?php echo $reasonrows[ 'txreason']; ?></option> <?php } while ($reasonrows = mysql_fetch_array($result)) ?> </select> </div> </form> </td> </tr> <tr> <td height="34"><div align="center"> <input type="button" name="button" value=" Ok " onClick = "writereason();"/>.....THEN somewhere at the bottom of this php file and after the ending php tag (?>) theres my javascript source as shown below:<script language='javascript' type='text/javascript'>function writereason() {alert('bout to request');}</script>THE PROBLEM is i get object expected error. theres not much to the function but i'd like the code to reach this function. -i tried putting this code on top of the file to no avail. -I tried to echo the entire portion of the script to no avail as well.-tried separting it to another "write.js.php" file and including it to this php file using 'include', putting it on top and bottom to no avail.Im not understanding how to call javascript functions from a php file. Please help!!!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...