0

I've been trying to style a PHP website using bootstrap. Most of the website including things like textbox and select are coded in PHP. How do I add bootstrap to it?

 array("type"=>"select", "name"=>"agentId", "value"=>getAgentASMOption($partyCode), "title"=>"Select Party");
3
  • can you add class or id? Commented May 31, 2017 at 9:28
  • How are you building your html tags from this array? Commented May 31, 2017 at 9:30
  • I don't know. I've been given a currently existing project by the company. And I'm new to PHP. Commented May 31, 2017 at 9:31

4 Answers 4

1

Bootstrap framework is just a library with classes and id's for styling HTML elements.

You can add the required class name in your php array in below manner.

array("type"=>"select", "class"=>"yourclass" , "name"=>"agentId", "value"=>getAgentASMOption($partyCode), "title"=>"Select Party");
Sign up to request clarification or add additional context in comments.

Comments

0

Add class attribute as :

array("type"=>"select", "name"=>"agentId", "value"=>getAgentASMOption($partyCode), "title"=>"Select Party","class"=>"myclass");

and then in css

.myclass{
 // your code
}

Comments

0

Add class attribute in your array and css to that class.

array("type"=>"select", "name"=>"agentId", "value"=>getAgentASMOption($partyCode), "title"=>"Select Party", "class"=>"selectClass");

css

.selectClass{
width: 100%;
}

2 Comments

Have you checked the console whether it is giving any error
No errors mate. It's just giving the same output. A simple dropdown.
0

Bootstrap is nothing more than a CSS and JS. You just need to add class/ID in HTML elements. I am assuming that in your PHP code have capabilities to add these things using array keys and values.

 array("type"=>"select", "name"=>"agentId", "value"=>getAgentASMOption($partyCode), "id"=>"fieldID", "class"=>"cssClass", "title"=>"Select Party");

Now you need to define these class in your css files. Make sure you define different values for responsive purpose in media query.

3 Comments

does it add ID and class element in your HTML tag?
I traced this array to another php file where the code is written in a function named getAgentASMOption like this: $str .= '<option value="'.$asm['partyCode'].'" '.$sel.'>'.$asm['NAME1'].' ----- '.$asm['ORT01'].' ----- '.$asm['partyCode'].' </option>';
it means it doesnt adding remain stuff... add pure HTML tag instead of php line to generate HTML and than you will be free to do anything with it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.