Jump to content

Multi button page


YigalB

Recommended Posts

I would like to create HTML page with 10 buttons.

Each button, when pressed, should execute a pre-defined PHP function.

 

I know how to do it with forms, but I don't need any user input - just the button.

 

I also need each button to have a pre-defined text on it, color and size. Some of them need to be grayed, until I finish the whole design - I plan to release the page with partial ability at first.

 

I would appreciate simple example.

Link to comment
https://forums.phpfreaks.com/topic/225300-multi-button-page/
Share on other sites

<a id="link1" href="file1.php">Php function 1</a>
<a id="link1" href="file1.php">Php function 1</a>
<a id="link1" href="file1.php">Php function 1</a>

CSS:

#link1
{
  background-color:red;
  color:white;
}

#link2
{
  background-color:blue;
  color:grey;
}

#link3
{
  background-color:yellow;
  color:pink
}

 

Link to comment
https://forums.phpfreaks.com/topic/225300-multi-button-page/#findComment-1163516
Share on other sites

you should use CLASSES for multiple items sharing the same elements, and ID for single instances of an element.

 

css styles should be kept in a separate file so multiple pages can access the same css over and over again. that way you only have to edit one file to affect your howl website.

 

to creat a style sheet just copy everything between <style type="text/css"> and </style> and remove /*<![CDATA[*/ from the beginning and /*]]>*/ from the end. you can call the new style sheet file using the following code in replace. <link rel="stylesheet" href="styles.css" type="text/css" /> styles.css being the name you gave your new file.

 

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>
  <title>Hello!</title>
<style type="text/css">
/*<![CDATA[*/
    .commonButtonElements {
      width: 100px;
      margin: 4px;
      cursor: pointer;
    }
    #button1 {
      background-color: #339966;
      color: #FFFFFF;
    }
    #button2 {
      background-color: #FF0066;

    }
    #button3 {
      background-color: #999999;
    }


/*]]>*/
</style>
</head>

<body>
<input type="button" name="field1" value="button1" class="commonButtonElements" id="button1"/>
<input type="button" name="field2" value="button2" class="commonButtonElements" id="button2"/>
<input type="button" name="field3" value="button3" class="commonButtonElements" id="button3"/>
<input type="button" name="field4" value="button4" class="commonButtonElements" id="button4"/>
<input type="button" name="field5" value="button5" class="commonButtonElements" id="button5"/>
<input type="button" name="field6" value="button6" class="commonButtonElements" id="button6"/>
<input type="button" name="field7" value="button7" class="commonButtonElements" id="button7"/>
<input type="button" name="field8" value="button8" class="commonButtonElements" id="button8"/>
<input type="button" name="field9" value="button9" class="commonButtonElements" id="button9"/>
<input type="button" name="field10" value="button10" class="commonButtonElements" id="button10"/>

</body>

</html>

Link to comment
https://forums.phpfreaks.com/topic/225300-multi-button-page/#findComment-1164398
Share on other sites

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.