Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


ECHO format

Posted on 2007-10-17
Medium Priority
Last Modified: 2013-12-13
I want to have a welcome banner and I am trying to use this
echo "<h1>Welcome</h1>" . $_POST['user'];
echo "<br>";
echo "You're now logged in. Try visiting <a href='asim.php'>Trial</a>.";

however it prints out on the page like this
You're now logged in. Try visiting Trial.

and I want the user on the same line as Welcome and also bold (h1) ... like this

Welcome user
You're now logged in. Try visiting Trial.

can someone help letting me know what am I doing wrong

Question by:syedasimmeesaq
  • 4
  • 2
LVL 18

Expert Comment

by:Mark Gilbert
ID: 20095187
echo "<h1>Welcome ". $_POST['user'] . "</h1>";
LVL 18

Expert Comment

by:Mark Gilbert
ID: 20095193
Reason was that you had closed the <h1> tags before echoing the posted user variable.  Using the code I provided appends all the code you need to make the echo statement work.

Author Comment

ID: 20095252
Ok thank you that worked. I have one more question if you don't mind answering me. I want the full name to be shown from the database table and the field is called full name. So I did this
$fullname = mysql_query("SELECT full_name FROM table_users WHERE password='" . $_POST['pass'] . "' AND users_name='" . $_POST['user'] . "'") or die("Couldn't query the user-database.");
$fname = mysql_result($fullname);
echo $fname;

echo "You're now logged in. Try visiting <a href='day.php'>Trial</a>.";

and it is not pulling the full name out of the database. Do you know what could be the reason.
Thank you very much
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

LVL 18

Accepted Solution

Mark Gilbert earned 2000 total points
ID: 20095312
Try this:

$fname = mysql_result($fullname, 0, 0);

Author Comment

ID: 20096300
yup thats it. Thank you so much
LVL 18

Expert Comment

by:Mark Gilbert
ID: 20096412
Glad I was able to assist.  Thanks for the points and have a great day.

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
This holiday season, we’re giving away the gift of knowledge—tech knowledge, that is. Keep reading to see what hacks, tips, and trends we have wrapped and waiting for you under the tree.
The viewer will learn how to dynamically set the form action using jQuery.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses

578 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question