0

Here is my code

PHP

<?php
    $count1 = $obj->getDatef();
    $as1 = $count1 + 6;
    $startdate = date('d/m/Y', strtotime($count1 . ' days'));
    $enddate = date('d/m/Y', strtotime($as1 . ' days'));

    echo "<script type='text/javascript'>";
    echo "alert('Current Timesheet period($startdate (Mon) ~ $enddate (Sun)) of 
              $pcode has been successfully Updated....!')";
    echo "</script>";
    echo "<script type='text/javascript'>";
    echo "window.location='my_tm.php'";
    echo "</script>";
?>

Here it have to print like this.....

Current Timesheet period

$startdate (Mon) ~ $enddate (Sun) of $pcode

has been successfully Updated....!

Samuel Caillerie
  • 8,259
  • 1
  • 27
  • 33

3 Answers3

0

There are two way the most popular is to use \n at the end of your echo to break line. Or you could use
tag which is less efficient as it will add markup to you page.

An example would be

echo("im line one \n im line two\n im line three");

this will out put

im line one
im line two
im line three
Dominic Green
  • 10,142
  • 4
  • 30
  • 34
0
echo "alert('Current Timesheet period\n
             $startdate (Mon) ~ $enddate (Sun) of $pcode\n
             has been successfully Updated....!')";

And here is the fiddle

David Houde
  • 4,835
  • 1
  • 20
  • 29
0
echo "alert('Current Timesheet period\n$startdate (Mon) ~ $enddate (Sun) of $pcode\n has been successfully Updated....!')";
Goutam Pal
  • 1,763
  • 1
  • 10
  • 14