Hey i have to make a pizza website for my assignment. I am done the HTML part and have finished the PHP more than half. I am trying to decorate it a bit and trying to use "\t" for tab, but its not working. Any suggestions?

P.S. I have made a separate PHP file.

echo "\t"."Confirmation Page<br/>";
$cost;
$counter=0;
echo "Personal data:<br/>";
isset($_POST["name"]) ? $name = $_POST["name"] : $name = "";
isset($_POST["phoneNumber"]) ? $phone = $_POST["phoneNumber"] : $phone = "";
echo $name."<br/>";
echo $phone."<br/><br/>";

I am having problems with "\t" in the first line.

Thanks :)

Recommended Answers

From my understanding. \t only works to beautify your HTML, you don't get this output to the screen. Any tab space gets treated like any old whitespace anyway. The easiest way to do this is to use CSS and text-indent.

Jump to Post

instead of:

echo "\t"."Confirmation Page<br/>";

try:

echo "<div style='padding-left:10px;'>Confirmation Page</div>";
Jump to Post

All 8 Replies

Member Avatar

From my understanding. \t only works to beautify your HTML, you don't get this output to the screen. Any tab space gets treated like any old whitespace anyway. The easiest way to do this is to use CSS and text-indent.

CSS in PHP? Can you provide me with an example? I am kinda new to PHP. Thanks for replying :)

instead of:

echo "\t"."Confirmation Page<br/>";

try:

echo "<div style='padding-left:10px;'>Confirmation Page</div>";

Oh wow, never knew we can use style in PHP. Thanks a lot :)

Member Avatar

Avoid inline styles. Use classes and CSS files:

echo '<div class="ind">Confirmation Page</div>';

CSS:

.ind{
  text-indent: 5em;
}

Thanks much for helping me. :)

Well you could use CSS but another solution is to use

<html>
<body>
<dd>Indented<br />
Non-Indented
</body>
</html>
Member Avatar

if using <dd> you should have a closing tag or it's invalid xhtml. Depends on the doctype.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.