CSS Styling for PHP Input Button

BConstable

I have got a working form and trying to add styling to the button. I've added CSS at the top and declared the button class but it won't style. The CSS is declared in a html tag at the top and the php code is embedded in this. The classes are the same. Any ideas why? Thanks In advanced.

<html>
<head>
<title>...</title>
<style type=”text/css”>

.btnsubmit {
    color: #fff;
    background-color: #3a7f7f;
    border-color: #3a7f7f;
}

.btnsubmit:hover {
    color: #fff;
    background-color: #183535;
    border-color: #183535;
}
</style>
</head>
<body>
<?php
$jinput = JFactory::getApplication()->input;
if(isset($_POST['submit'])) {
    $db = JFactory::getDbo();
    $query = $db->getQuery(true);
    $user = JFactory::getUser();
    $userID = $user->get( 'id' );
    $date = date("Y/m/d");
    $description = $jinput->get('description', null , null);
    $subsection = $jinput->get('subsection', null , null);
    $urgency = $jinput->get('urgency', null , null);
    $status = "Waiting Attention";
    $columns = array('userid', 'rdate', 'description', 'area', 'subsection', 'urgency', 'status');
    $values = array($userID, $db->quote($date), $db->quote($description), $db->quote($selected), $db->quote($subsection), $db->quote($urgency), $db->quote($status));
    $query
        ->insert($db->quoteName('#__website_issues'))
        ->columns($db->quoteName($columns))
        ->values(implode(',', $values));
    $db->setQuery($query);
    $db->execute();
    echo "<h4>Thank You! Issue Successfully Reported!";
}
echo "<table style='text-align:center;text-align:center;margin-left:41%;'>";
echo "<tr><td><h4>Report Website Issue</h4></td></tr>";
echo "<tr><td><form method='post'><select name='area'  onchange='this.form.submit()'>
<option value=''>Select Website Area</option>
<option value='General'>General</option>
<option value='Emails'>Emails</option>
<option value='Education'>Education</option>
<option value='Reviews'>Reviews</option>
<option value='Store'>Store</option>
<option value='Toolkit'>Toolkit</option>
<option value='Membership'>Membership</option>
<option value='Other'>Other</option>
</select></form>
</td></tr>";
echo "<form method='post'>";
$selected = $jinput->get('area', null, null);
echo "<tr><td><h5><center>Current Area Selected: $selected</center></tr></td></h5>";
if($selected == 'General') {
    echo "<tr><td><input type='text' name='subsection' placeholder='Subsection'></td></tr> ";
}
else if($selected == 'Emails') {
    echo "<tr><td><select name='subsection'>
    <option value=''>Select Email System</option>
    <option value='Notification'>Notifications</option>
    <option value='Newsletter'>Newsletter</option>
    <option value='Store'>Store Emails</option>
    </select></td></tr>";
}
else if($selected == 'Education') {
    echo "<tr><td><select name='subsection'>
    <option value=''>Select Subsection</option>
    <option value='Lighting'>Lighting</option>
    <option value='Sound'>Sound</option>
    <option value='Rigging'>Rigging</option>
    <option value='StageManagement'>Stage Management</option>
    <option value='ConsoleTraining'>Console Training</option>
    <option value='Tips'>Tips</option>
    </select></td></tr>";
}
else if($selected == 'Reviews') {
    echo "<tr><td><input type='text' name='subsection' placeholder='Specific Review'></td></tr> ";
}
else if($selected == 'Store') {
    echo "<tr><td><input type='text' name='subsection' placeholder='Store Area'></td></tr> ";
}
else if($selected == 'Toolkit') {
    echo "<tr><td><input type='text' name='subsection' placeholder='Specific Tool'></td></tr> ";
}
else if($selected == 'Membership') {
    echo "<tr><td><select name='subsection'>
    <option value=''>Select Membership Plan</option>
    <option value='Member'>Member</option>
    <option value='Student'>Student</option>
    <option value='Educator'>Educator</option>
    </select></td></tr>";
}
else if($selected == 'Other') {
    echo "<tr><td><input type='text' name='subsection' placeholder='Subsection'></td></tr> ";
}
echo "<tr><td><select name='urgency'>
<option value=''>Select Urgency</option>
<option value='Minor'>Minor</option>
<option value='Serious'>Serious</option>
<option value='Urgent'>Urgent</option>
</select></td></tr>";
echo "<tr><td><textarea rows='6' cols='50' name='description' placeholder='Please Describe The Issue'></textarea></td></tr>";
// Submit
echo "<tr><td><input type='submit' class='btnsubmit' name='submit' value='Submit Issue'>";
echo "</form></table><hr>";
?>
</body>
</html>
Funk Forty Niner

I wrote it in a comment, but wanted to further add/elaborate to this for future readers.

It's the curly quotes ” ” in <style type=”text/css”>

Change it to <style type="text/css"> using regular quotes ".

Even with error reporting on, that would not have thrown a notice and would be futile.

However, had curly quotes been used in an echo:

echo ”<tr><td><textarea rows='6' cols='50' name='description' placeholder='Please Describe The Issue'></textarea></td></tr>”;

for example and using part of your echo with curly quotes in opening/closing, that would have thrown something like:

Parse error: syntax error, unexpected '>' in /path/to/file.php on line x

Or even

echo ”Hello world”;

would have thrown a parse error in its most simplest form:

Parse error: in /path/to/file.php on line x

If you're coding using some type of word processing software, stop right there and use a code editor instead. Those are 2 different animals altogether.

To finish off, you can simply use

<style>
.class {
}
</style>
  • In HTML5, the type attribute is no longer required for CSS. The default value is "text/css".

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related