Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

adding php to button onclick

Featured Replies

How do I add php to button onclick? I dont wish to use jquery as i have been using javascript and i dont wanna complicate things and jqeury is all i could generally find.

does it basically work the same way as in javascript, you make a function using php then call the function using inclick ?

e.g. <?php function Myfunction()
{
}
?>

<input type = "button" name="click here" onClick="return Myfunction()";>

sorry for my n00b question haha

PHP is Server Side, the onclick event is typically used with Javascript, which is client side, PHP is processed on the server and compiled/converted to HTML which you see in the browser window, your PHP functions and variables are never seen client side.

 

If you want the form to get processed in PHP without using Javascript you'll have to use a form and send the post data to your PHP script for processing.

 

 

<form method="post" action="myPHPScript.php">
...
<input type="submit" value="Click Here"/>
</form>

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.