/    Sign up×
Community /Pin to ProfileBookmark

style in php code

How do i apply a class (stlyesheet class) to the code below. I tried wrapping <span> tags around the php code, but it didn’t work.

Note: the code below is in html code

[code=php]<?php
}
else
{
echo “No county selected… Please select a countyn”;

?>[/code]

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@holyhttpJul 05.2007 — Using a class style presumes that you have already defined that class somewhere in your HTML document which is not the case here.

Since your code does not show any HTML dosument structure where you would have your CSS style, I recommend you use an inline style:

[I]echo "<span style="your style goes here">No county selected... Please select a county</span>n"; [/I]

This will not make your code clean though and will make your application maintenance hard.
Copy linkTweet thisAlerts:
@TJ111Jul 05.2007 — Just do something like this:
[code=php]
<?php
}
else
{
echo "<p class='your_class_name'>No county selected... Please select a county</p>n";

?>[/code]


You can echo any html tags in your php. Just be careful with your quoatation marks,
×

Success!

Help @oo7ml spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.13,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...