Forum Moderators: coopster
<?php
$sql = "SELECT * FROM musicinstructionservices ORDER BY id ASC LIMIT 0, $newsnum";
$sql_result = mysql_query($sql) or die ("<font face=verdana>Error: ".mysql_error());
while ($row = mysql_fetch_array($sql_result))
{
$id = $row["id"];
$services = $row["services"];
echo "<label><input type=radio name=services value=$services style='font-family: verdana; color:#FFFFFF; font-size: 8pt; background-color: #4791C5; font-weight: none; border: 1px solid #CCCCCC'><font face=verdana size=1>$services</font></label><br><br>";
}
?>
It's really weird because I tried it with a selection list and the whole value (all of the words) shows up in the email. I don't know if it's the database or the code or that's just how a radio buttons work. Is there any way around this?
I can't use a selection list because the displayed lines stretches my table...
Thanks.
echo '<label><input type="radio" name="services" value=[b]"[/b]'.$services.'[b]"[/b] style="font-family: verdana; color:#FFFFFF; font-size: 8pt; background-color: #4791C5; font-weight: none; border: 1px solid #CCCCCC"><font face="verdana" size="1">$services</font></label><br><br>'; I'm not quite sure of exactly what the problem is; your description of what's happening left me thinking, "I don't get it." Anyways, replacing one line in your code with the line above might help.
A lot of webpeople get into the habit of leaving out the quotes around properties and such in HTML, and never really suffer for it - until they get to forms. If your problem is that your HTML formatting is showing up in what's supposed to be your 'services', this may be it - without the opening and closing quotes, the browser will have a hard time distinguishing the value of the field and the rest of your markup.
The bolded quotes in the line are the ones that are more crucial, but since you're needing to quote, I just put in quotes for all the other properties as well, since that's the way to go.
One additional, nit-picking remark: you have some redundant mark-up there; you could probably remove the <font> tag and maybe add a closing </style> tag right before your closing </label> tag.