Jump to content

Recommended Posts

A button is clientside, PHP is a serverside language. You'd need to use a form like this..

 

<form action="whatever.php" method="post">

<input type="button" value="click me to calculate!"/>

</form

 

And it'll POST and inputs etc. to whatever.php. If you use a text input for example like you'd see in normal forms.. if an input was named 'name="ID" ' you could see it in PHP as.. $_POST['ID']..

 

Edit: You may want to use JS to insert a random number into the box. You can do buttons like this..

 

<button onClick="document.getelementbyID('rand1').value = 4">Button</button>

Link to comment
https://forums.phpfreaks.com/topic/170546-button-to-execute/#findComment-899610
Share on other sites

You mean like <input type="image" name="submit" > ???

 

When an image is clicked it sends the XY coordinates of the screen position that the mouse clicked.

 

To execute code with an image input you have to use


if ( isSet($_POST['submit_x']) )
{
   //code
}
//or 
if ( isSet($_POST['submit_y']) )
{
   //code
}

Link to comment
https://forums.phpfreaks.com/topic/170546-button-to-execute/#findComment-899612
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.