I would like to embed a JavaScript alert box into php code and would like the text to report variable values. The following code gives multiline but does not enable me to use variables.
?>
<script type="text/javascript">
alert("Total size of all files too large.
Consider uploading files in smaller sets.
You can append to existing sets.");
document.location.href="SomewhereElse.php";
</script>
<?php
The following code lets me use variables but does not give multiline.
$Str="Total size cannot be not more than " . ini_get('post_max_size');
echo "<script type='text/javascript'>
";
echo "alert('" . $Str . "');";
echo "</script>";
When I try this code, no alert box comes up.
$Str="Unable to load (all of) these files because of their (total) size" .
"
Please make the upload set conform to the following parameters";
echo "<script type='text/javascript'>
";
echo "alert('" . $Str . "');";
echo "</script>";
I do get an alert box if I leave the (before the Please) out but it is not multiline. I am wondering if the dismisses the alert box. At any rate, how do I get a multiline alert box with variables?