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