How to use CSS code to style vote button in php file?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
chesterskeeper
Forum Newbie
Posts: 1
Joined: Fri Jun 04, 2004 3:51 pm

How to use CSS code to style vote button in php file?

Post by chesterskeeper »

Hello.

I am trying to use the regular submit button for my poll using a php script. I want the submit button to match just like the other one I currently have on the page....gray background, highlights with yellow borders when hovering.

In HTML, the code is:

<input type="button" value="Submit">

How can I use the same look of that submit button in this code:

// Use CSS code to style the 'vote' button
$buttonstyle="border:1px solid gray;
background:#CCCCCC;color:black;";

When I tried:
$buttonstyle="input type"button" value "submit"";

I saw a small button (just the one I wanted) but all text was missing so of course it didnt work. I tried adding brackets and commas, couldn't get anything to work.

Can someone please help me here??

Thanks!
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Code: Select all

<input type="button" value="Submit" style="<?php echo $buttonstyle; ?>">
that'll do it, if the page is a php processed page, and is outside the <?php tags...

inside php tags:

Code: Select all

echo '<input type="button" value="Submit" style="'.$buttonstyle.'">';
// or
echo "<input type="button" value="Submit" style="$buttonstyle">";
// there are many more ways.. but you get the picture, I hope.
Post Reply