Reputation: 301
<input type="radio" name= <?php echo "<a href ='profile.php?user=$user_id' class='box' style='display:block'> $username </a>";?> />
The above line of code functions correctly when parsed but when run a the closing
/>
is added at the end. so it produces the appropriate username with radio button, but following the username, for instance instead of
michael_jackson
I get
michael_jackson/>
Sorry, I know this is elementary but I'm not seeing what's wrong.
Upvotes: 1
Views: 40
Reputation: 1951
You are trying to echo the <a>
element inside the name property of your input. This isn't valid HTML.
I am assuming you want to have the text for the radio button be a link, so try this instead:
<input type="radio" name="user" /><a href="profile.php?user=<?php echo $user_id; ?>" class="box"><?php echo $username; ?></a>
Also its really personal preference but whenever possible I think it's better to keep the HTML separate from the PHP.
Note: Because I am assuming you want the text to be next to the input I removed the display:block;
style.
Upvotes: 3