+ 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??

20th Sep 2021, 4:46 AM
Sara012
Sara012 - avatar
22 Réponses
+ 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.
20th Sep 2021, 10:13 PM
Mehran
Mehran - avatar
+ 3
As same as in simple html. within head tag <link rel="stylesheet" href="style.css">
20th Sep 2021, 5:06 AM
Shadoff
Shadoff - avatar
+ 3
You can divide you PHP file code into many parts! Like this: < php ? ?> <html> here put the head tag! </html> <php? ?>
20th Sep 2021, 5:29 AM
Shadoff
Shadoff - avatar
+ 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.
20th Sep 2021, 5:47 AM
Shadoff
Shadoff - avatar
+ 3
What exactly did the teacher ask of you?
20th Sep 2021, 7:16 PM
Mehran
Mehran - avatar
+ 2
Sara012 this question is flawed. why you are trying to apply styles in server side?!! we do this in client side. usually.
20th Sep 2021, 3:27 PM
Mehran
Mehran - avatar
+ 2
Validation form by php...but i have to insert style error input and style error image in php...
20th Sep 2021, 9:29 PM
Sara012
Sara012 - avatar
+ 1
Wow yes,thanks ...i will check it
21st Sep 2021, 5:03 AM
Sara012
Sara012 - avatar
+ 1
I checked it but echo statement did not work...I don't know the reason
21st Sep 2021, 5:31 AM
Sara012
Sara012 - avatar
+ 1
How do you run php?
21st Sep 2021, 8:31 AM
Mehran
Mehran - avatar
+ 1
I rename my html file to php file such as: index.html ---> index.php
21st Sep 2021, 3:16 PM
Sara012
Sara012 - avatar
+ 1
Sara012 😐 you should run it in a server
21st Sep 2021, 3:28 PM
Mehran
Mehran - avatar
+ 1
Well Of course😐
21st Sep 2021, 3:35 PM
Sara012
Sara012 - avatar
+ 1
I know all of this
21st Sep 2021, 3:37 PM
Sara012
Sara012 - avatar
+ 1
did you install php?
21st Sep 2021, 3:38 PM
Mehran
Mehran - avatar
+ 1
Virtual server you say??
21st Sep 2021, 3:39 PM
Sara012
Sara012 - avatar
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
20th Sep 2021, 5:14 AM
Sara012
Sara012 - avatar
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?
20th Sep 2021, 5:37 AM
Sara012
Sara012 - avatar
0
Because this is my project...this is hard for me 🤕& i know that usually style with css and js
20th Sep 2021, 3:48 PM
Sara012
Sara012 - avatar
0
For php??
21st Sep 2021, 3:39 PM
Sara012
Sara012 - avatar