Ken wrote:
Does php work with onClick in an html input statement?
<HTML>
<input type="button" name="add_picture" value="Add another picture"
onClick="<?php picture_count(); ?>">
I want to call the function picture_count() when button labeled "Add another
picture" is clicked in HTML
I do not want to use submit in place of button since I do not want to submit
the form at this time.
With the above statement, I receive an error expected ";" and the function
is not called.
Thanks!
You are mixing two different technologies together... PHP is server side
- The onClick event is client side... This means that your PHP code is
parsed/run BEFORE it gets to the user/client side.
If PHP is correctly configured on your server, then view the page where
you have the above code - My bet is that in the 'onClick' event, you
will NOT see <?php picture_count(); ?> but instead see the result of
picture_count() - And unless you manage to store the value/result of
picture_count somewhere on your server, then I'd guess that the value
will always be the same, no matter how many uploads you did.
Chances are, someone in comp.lang.javascript will (at least in part)
help you towards a solution...
laters
randelld