1

I'm trying to right align a date and 6 lines of text on a letterhead using PHP, but either break the PHP code or it isn't right aligning all the text lines. This is the existing PHP code I've adjusted to this point which right aligns the date and the first two lines, but the rest of the text lines are still on the left. The end result I want to achieve is to align the date and the 6 lines of text after the date on the right side of the page.

<?php 
echo "<br />";
echo "<br />";
echo "<div align='right'>";
echo date("d/m/Y") . "</div><br />";
echo "<br />";
echo "<br />";
$user_info = wp_get_current_user(1);
echo "<div align='right'>";
echo $user_info->first_name .  " " . $user_info->last_name . "\n";
echo "Job Title</div>" . "\n";
echo 'Email: ' . $user_info->user_email. "\n";
echo 'Mobile: ' . $user_info->mobile_number. "\n";
echo 'Web Address: ' . $user_info->webaddress1. "\n";
echo 'Facebook Page: ' . $user_info->facebook. "\n";
echo "<br />";
echo "<br />";
echo "<hr />";
echo "Dear "  . $_POST["c_name"] . "," . "\n";

I'm very new at this so thanks so much for any help and suggestions.

wiredafrican
  • 13
  • 1
  • 3
  • I don't think PHP has to do anything with it you should use 'text-align:right' CSS property on the `container/wrapper` of the text you are trying to right align. – Muhammad Omer Aslam Nov 26 '17 at 12:31

1 Answers1

0

change your code at line 9 from echo "<div align='right'>"; to echo "<div style='text-align:right'>";

wahmal
  • 809
  • 11
  • 27
  • Thanks wahmal. Your suggestion helped a lot in my understanding of PHP. I had seen another example that used align='right' instead of 'text-align:right', so I had already been mis-directed with that. By inserting the style to style the div correctly then moved the whole div across to the right side. – wiredafrican Nov 26 '17 at 23:19