How can i insert style css in php?? | Sololearn: Learn to code for FREE!

+4

How can i insert style css in php??

İ want to be apply class css on input tag in html that use the class in php...how can i use it in php??

9/20/2021 4:46:44 AM

Sara012

22 Answers

New Answer

+2

Sara012 oh easy to do. this is php guide for form validation. https://www.w3schools.com/php/php_form_validation.asp if received data is invalid, echo to client an image like red cross image or something like. if you want to echo same document but with changing style, place this in head tag : if(validate) echo '<link href="validate.css" rel="stylesheet"></link>' else echo '<link href="invalidate.css" rel="stylesheet"></link>'. but in reality users can't sent invalid data because we check it by Javascript. but hackers can send invalid data.

+3

As same as in simple html. within head tag <link rel="stylesheet" href="style.css">

+3

You can divide you PHP file code into many parts! Like this: < php ? ?> <html> here put the head tag! </html> <php? ?>

+3

Sara , can't get what you are talking about. What class, and how it related with input? if you want to style differently like day/night mode why don't you use JS for it? any way, you can change class of any container using PHP.

+3

What exactly did the teacher ask of you?

+2

Sara012 this question is flawed. why you are trying to apply styles in server side?!! we do this in client side. usually.

+2

Validation form by php...but i have to insert style error input and style error image in php...

+1

Wow yes,thanks ...i will check it

+1

I checked it but echo statement did not work...I don't know the reason

+1

How do you run php?

+1

I rename my html file to php file such as: index.html ---> index.php

+1

Sara012 😐 you should run it in a server

+1

Well Of course😐

+1

I know all of this

+1

did you install php?

+1

Virtual server you say??

0

Yes i know but php is not accepting and your answer is not suit for my question,maybe i can't ask question very well but thank you

0

Yes i know it but i want to call class css in php and my class declare on input tag,how can i do this?

0

Because this is my project...this is hard for me 🤕& i know that usually style with css and js

0

For php??