hai
my code is like this
<?php function subtraction(){ $result =$value1+$value2; } ?> when i ran the program its ok.but i click the button error messagebox coming? what is the problem? can anybody guide me?hai
my code is like this
<?php function subtraction(){ $result =$value1+$value2; } ?> when i ran the program its ok.but i click the button error messagebox coming? what is the problem? can anybody guide me?Well, I going to guess at this since you didn’t give me any kind of a clue what kind of an error message you get, but I guessing it is a Javascript error.
onClick is used for javascript not php. Javascript is a client-side language where as php is a server-side language.
The only way to make this script work as you intend is to something like the following:
[php]<?php
$send = $_POST[‘send’];
if(isset($send) && $send == ‘Go’)
{
$result = $value1 + $value2;
}
else
{
?>
PS: I however did leave out the rest of $_POST[’’]. I figured you could add these in and should as Global Variables should NOT be turned on!
If you are having trouble even getting a simple form to submit data then I would highly recommend not even worrying about functions at this point. You need to get a good handle on what PHP is. Once you have this kind of understanding you should be able to understand what it can and can’t do.
hai
Ragster thanks for ur help and guidance.
my problem is how to get the text field values locally ?
dont use the post method?
and how can we write actions for buttons in php like javascript functions?
any posibility ?
can u guide me
thanks in advance
bye
Manju
First, I am not trying to be a jerk, but do you understand the difference between, server-side and client-side scripting?
This a very important understanding as it is at the core of php.
yes i got the concept of server side and client side scripting.
php is server side scripting and java script is client side scripting.
thanks for ur help
Ok, Sorry… I hope you didn’t take offense to my post. I am just trying to make sure people understand what they are doing so they don’t waste their time.
Or ours
@Linuxhero:
PHP is a server-side language (go look that up on google) and JavaScript is a client-side language (hope you still have your google window open
The difference between SS and CS languages is so fundamental that you cannot mix them up.
For some pointers, google the following terms:
And maybe: