madman_
11-06-2010, 09:44 PM
Good evening,
I am in the process of my website development and I'm a little stuck.
I am trying to send a HTML form, without having the page refreshed.
Here's some code where I can explain what my situation is:
<Form Name='clickform' Method ='POST'>
<input
type='image'
name='button1'
src='images/button_1.png'
onmouseover='this.src='images/button_1.png''
onmouseout='this.src='images/button_1.png''
width=27
hight=31
/>
</Form>
That is the HTML code I have for my button, which has the following effect when clicked:
<?php
if(isset($_POST['button1_x']))
{
echo "button1 has been pressed.<br>";
}
?>
Now what i'm after is that I want the PHP code to be executed when the button is pressed.
It's working perfectly as long as the page is refreshed when the button is clicked, however I need the PHP code to be executed without a page refresh.
I've heard of AJAX and whatnot, not particularly sure how I can use it, I'm a pretty decent PHP coder, know some HTML, but never touched any javascript. Is there any simple way I can accomplish my goal without complicated javascript?
Thank you.
I am in the process of my website development and I'm a little stuck.
I am trying to send a HTML form, without having the page refreshed.
Here's some code where I can explain what my situation is:
<Form Name='clickform' Method ='POST'>
<input
type='image'
name='button1'
src='images/button_1.png'
onmouseover='this.src='images/button_1.png''
onmouseout='this.src='images/button_1.png''
width=27
hight=31
/>
</Form>
That is the HTML code I have for my button, which has the following effect when clicked:
<?php
if(isset($_POST['button1_x']))
{
echo "button1 has been pressed.<br>";
}
?>
Now what i'm after is that I want the PHP code to be executed when the button is pressed.
It's working perfectly as long as the page is refreshed when the button is clicked, however I need the PHP code to be executed without a page refresh.
I've heard of AJAX and whatnot, not particularly sure how I can use it, I'm a pretty decent PHP coder, know some HTML, but never touched any javascript. Is there any simple way I can accomplish my goal without complicated javascript?
Thank you.