0

I'm trying to embed some CSS into my PHP file. How can I properly add my CSS so that each called form will be rendered inside a black border? This is what I tried so far.

 while ($ratings = mysql_fetch_array($q))
    {
        //This outputs the doctors's name
        echo "Doctor's name:" . $ratings['doctor_name'] ."<br />";

            // Retrieve the id of the doctor which was posted on
            $id = $_POST['id'];

            echo "<style> form { border-style: solid; border-color: #ffffff}"; 

            //This outputs a textarea for the user to submit comments

            echo "<b>Your Experience: </b>";
            echo "<form method='post' action='review_doctors.php'> 

                    <textarea name='body'></textarea>
                    <input type='submit' name='submit' value='Send'/>

                    <input type='hidden' name='id' value='$ratings[id]' />

                    </style>

                 </form>
                 ";


            echo "<br />";
}
2
  • 2
    Why are you wrapping the form in the style tag? The style tag should only include styles. Commented Nov 20, 2014 at 20:38
  • And then your style tag is terminated before the form is. This kills the HTML. Commented Nov 20, 2014 at 20:41

1 Answer 1

2

As mentioned in the comments: "The style tag should only include styles".

?>
<style>
form {
    border: 3px solid black;
}
</style>
<?php
while ($ratings = mysql_fetch_array($q)) {
    echo "<form>...</form>"
}

If you would like to reuse styles you can put them in their own file and then include them on each page:

?>
<link rel="stylesheet" type="text/css" href="/path/to/mystyle.css">
<?php
// ...
Sign up to request clarification or add additional context in comments.

Comments

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.