Connecting Tech Pros Worldwide Help | Site Map

c alling a function with a button click

 
LinkBack Thread Tools Search this Thread
  #1  
Old July 17th, 2005, 01:35 AM
chris
Guest
 
Posts: n/a
Default c alling a function with a button click

hi all

im relativly new to PHP but loving it - its fantastic isnt it (reminds me a
lot of BASIC on steroids)

my question is this

how do i call a function from a button using php??

Thanks







  #2  
Old July 17th, 2005, 01:36 AM
Savut
Guest
 
Posts: n/a
Default Re: c alling a function with a button click

You can't do that with PHP, this is not a kind of stuff that PHP because it is server side. You need to use Javascript for that.

Savut

"chris" <someone@here.com> a écrit dans le message de news:3fd887a3$1@funnel.arach.net.au...[color=blue]
> hi all
>
> im relativly new to PHP but loving it - its fantastic isnt it (reminds me a
> lot of BASIC on steroids)
>
> my question is this
>
> how do i call a function from a button using php??
>
> Thanks
>
>
>
>
>
>[/color]


  #3  
Old July 17th, 2005, 01:36 AM
Robert Downes
Guest
 
Posts: n/a
Default Re: c alling a function with a button click

chris wrote:[color=blue]
> im relativly new to PHP but loving it - its fantastic isnt it (reminds me a
> lot of BASIC on steroids)
>
> my question is this
>
> how do i call a function from a button using php??[/color]

You could call a PHP script using

<form action='phpscript.php' method='post'>
<input type='hidden' name='varname' value='something' />
<input type='text' name='uservarname' />
<input type='submit' value='click me' />
</form>

and then, in phpscript.php you can get the value of the hidden field by
referring to $_POST['varname'], and you can see the value that the user
typed into the text field by refferring to $_POST['uservarname'].

E.g.

echo "<p>Hello there. You typed ".$_POST['uservarname']."</p>";

That will cause things to happen when a user presses a form submission
button on a PHP script, and you can add the value of the POST variables
to a database, or vary the output of the script using if statements
based on the variables.

However, Savut is right. You may be thinking of instant response without
loading another PHP page. That is client-side scripting, using, most
often, the hideous JavaScript. JavaScript is utterly foul. Avoid it at
all costs. If you must have pretty, irritating, 'interactive' bits and
pieces on your site, think about using Flash. It costs money (boo!) but
at least it is a fixed standard (due to monopoly, albeit) and it works.
JavaScript makes even the most expensive corporate pages fail and look
poorly produced.
--
Bob
London, UK
echo Mail fefsensmrrjyaheeoceoq\! | tr "jefroq\!" "@obe.uk"
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,989 network members.