When you have a form you can check if the form has been submitted and then do a query or something.
I want to have a button/image when clicked it runs the code.
How would I do this?
button add
Re: button add
well you would do this:
<input type="image" src="your image" name="some name" onsubmit="submit-form();">
Re: button add
(im a noob at php)
im guessing
im guessing
onsubmit="submit-form();"is referring to a function?
< my attempt at a logo
Re: button add
yes, but you can alsow use the button type thing :
hope it helps.
<button type="submit" name="button1" value="clicked"> <img src="image" width="32" height="32" alt="submit" border="0" /> </button>and just add the onclick="the action" thing.
hope it helps.
Re: button add
There is a simple CSS work around for this.
<form method="post" action=""> <input type="text" name="text_field" /> <input type="submit" name="submit" value="" class="button_with_image" />and then you would have a CSS file with a declaration something like:
.button_with_image{ background: url(images/image-you-need.png) no-repeat; height: 100px; width: 100px; }and then you just have an HTML input submit button, with a picture instead of the regular button.
Re: button add
You can use input type="image" and just treat it like a normal submit button
<input type="image" name="submit" src="img.png" />then you have to check
if (isset($_POST['submit_x']))because the image input sends two $_POST variables, one for the x coordinate you clicked on the image and one for the y.