Jump to content

how to access php code by html events.


techrahul87

Recommended Posts

No, there's no events. When you go to a webpage, your browser requests the page from the web server, Apache for example. If the page is written in PHP, Apache then calls on PHP to process that page and then sends you whatever code PHP generated. After that the page in your browser is a done deal, no changes and no more communication to the web server. If you want to replace parts of the page or call a PHP script, you'll have to use Javascript to request that page from the server while your browser keeps displaying the same page.

PHP != C

 

You want to check for certain values a form submission will give to PHP.

 

Try using the code

print_r( $_POST );

to get an idea of what those values are, depending on what button is pressed.

 

PHP will use the name attributes of the HTML form elements as the array keys.

hi,

 

  isn,t there any other way for it. like in c# we can make different functions for events by adding simply runat="server".

  and calling them.

  now i m getting really confused.

 

please give an explanation....... :confused: :confused:

 

C# (.net) uses Ajax in the background to make requests between the client and server. PHP won't hold your hand like that. You will need to develop both the client side & server side code to make the Ajax requests yourself.

 

Using a framework like jQuery on the client side makes these things pretty simple though so I'm not sure what the issue is.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.