View Full Version : Anyone that can help me?

11-06-2010, 10: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'>

That is the HTML code I have for my button, which has the following effect when clicked:

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.

11-06-2010, 10:52 PM
Is there any simple way I can accomplish my goal without complicated javascript?

Nope. You'll need to use AJAX.


11-06-2010, 11:01 PM
Okay, so how would i do this, i see the sample code it provides on your link where it says "Try it yourself", but i'm not sure how i could use this to just send the form. It appears to me that the actual code to display the text is in javascript too. Is it possible to use the javascript to execute PHP code?

By any chance could you write me a simple piece of code with a HTML form and the php linked to the javascrpt AJAX so it sends the form without a refresh? I'd be ever so grateful, Thank you.

11-07-2010, 12:09 AM
We've all had to learn it the hard way, so you need to get your hands dirty and start coding and testing. You'll ne'er learn if you don't try. If you get stuck, by all means post your progress code and someone will help, but the initial attempt has to be made by yourself, (unless you want to hire a coder in the relevant section of the forum to do it for you, that is).