/    Sign up×
Community /Pin to ProfileBookmark

formatting in php echo

i have a redirect on my site after the user signs in which is basically a php echo, problem is it looks ugly as its just a white background and black text

is there anyway to change the background colour, add images and format the text?

cheers for any help

heres the code i have now

[code=php]

if (mysql_num_rows($result) == 1) {
$_SESSION[‘user_logged’] = $_POST[‘username’];
$_SESSION[‘user_password’] = $_POST[‘password’];
header (“Refresh: 0; URL=” . $_POST[‘redirect’] . “”);
echo “<h2>Logging in to I.P Addressing Tutor – Stand By</h2><br>”;
“<a href=”” . $_POST[‘redirect’]. “”>click here</a>)”;
} else {
?>

[/code]

to post a comment
PHP

6 Comments(s)

Copy linkTweet thisAlerts:
@acorbelliFeb 21.2006 — Simply include the proper html to change the text colour in the echo statement, or use a previously defined style within the HTML surrounding your PHP code.
Copy linkTweet thisAlerts:
@HuevoosFeb 21.2006 — [code=php]
echo <<<CODE
<html>
<head>
<style>
body{
background: #xxxxxx;
color: #xxxxxx;
}

h2{
...
...
...
...
}
</style>
<title>Redirecting</title>
</head>

<body>
<h2>bleblebleblebl ble ble ble ble <a href="ble ble">ble ble </a>
</body>
</html>
CODE;
[/code]


You get the idea I hope, also the most common problem while using this syntax is indenting the last "CODE;" make sure that there is nothing in the samem line, not even a space
Copy linkTweet thisAlerts:
@welshFeb 21.2006 — or just use an include that has it already formatted and such.
Copy linkTweet thisAlerts:
@Markbad311Feb 21.2006 — woa woa woa so is your example telling me if I enclose it in <<<CODE I don't have to escape quotes and such in my XHTML?

whit indenting CODE; you mean no indenting right so there is no whitespace before it? I assume white space after doesn't matter right.
Copy linkTweet thisAlerts:
@Mester_PedizFeb 21.2006 — [CODE]<html>
<head>
</head>

<body bgcolor="cccccc">

<?php

if (mysql_num_rows($result) == 1) {
$_SESSION['user_logged'] = $_POST['username'];
$_SESSION['user_password'] = $_POST['password'];
header ("Refresh: 0; URL=" . $_POST['redirect'] . "");
echo "<h2><font color="green">Logging in to I.P Addressing Tutor - Stand By</font></h2><br>";
"<a href="" . $_POST['redirect']. "">click here</a>)";
} else {
?>

</body>
</hmtl>[/CODE]


Now it stuffed into html code, you can change the font like i'we done and add images 'n stuff, or mangle it with a style sheet, but that's all you need to do.
Copy linkTweet thisAlerts:
@cashton2kauthorFeb 21.2006 — cheers guys
×

Success!

Help @cashton2k 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.19,
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,
)...