PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
I'm good at HTML but I'm having a problem with it when it is within PHP tags. In the statement below I want to insert "Align=Center". What't the right format?
<?php
function print_error($reason,$type = 0) {
build_body($title, $bgcolor, $text_color, $link_color, $vlink_color, $alink_color, $style_sheet);
// for missing required data
if ($type == "missing") {
if ($missing_field_redirect) {
header("Location: $missing_field_redirect?error=$reason");
exit;
} else {
?>
<p align="center"><b>The Form Was Not Submitted For the Following Reasons:</b></p>
<ul><?
echo $reason."\n";
?></ul>
<p align="center"><b>Please use your browser's back button to return to the form and try again.</b><?
}
} else { // every other error
?>
The form was not submitted because of the following reasons:<p>
<?
}
?>
<?php
function print_error($reason,$type = 0) {
build_body($title, $bgcolor, $text_color, $link_color, $vlink_color, $alink_color, $style_sheet);
// for missing required data
if ($type == "missing") {
if ($missing_field_redirect) {
header("Location: $missing_field_redirect?error=$reason");
exit;
} else {
?>
<p align="center"><b>The Form Was Not Submitted For the Following Reasons:</b></p>
<div align="center"><?
echo $reason."\n";
?></div>
<p align="center"><b>Please use your browser's back button to return to the form and try again.</b><?
}
} else { // every other error
?>
The form was not submitted because of the following reasons:<p>
<?
}
?>
Within the PHP open and close tags I've figured out the "Bold", "Underline", "Links",ect but I still can't figure out how to code "align=center". Shown below are plain "echo" statements that are aligned to the "left". Is there any code I can put in the statements themself to get them to align in the center of the page?
<?php
echo "<b><h3>Thank you for your message.</h3></b>\n";
echo "<b><h3>If requested a reply will be sent within 24 hours.</h3></b>\n";
echo "<b><h3>Click <a href="../index.php">Here</a> To Return.</h3></b>\n";
echo "<br><br>\n";
?>
<?php
echo "<div align="center"><b><h3>Thank you for your message.\n";
echo "If requested a reply will be sent within 24 hours.\n";
echo "Click <a href="../index.php">Here</a> To Return.</h3></b></div>\n";
echo "<br><br>\n";
?>
To center something, just use <div align="center"> or use CSS to position it.
i know its not the "correct" way of doing it but i usually just do things like:
if i need to align something inside PHP use:
<align=center>
it works exactly the same without the quotations, and works properly on the browsers ive tested such as:
Internet Explorer 6
Mozilla (latest version)
Mozilla Firebird (latest linux version)
Opera 7.0
dunno about netscape coz its a horrible browser so i wont use it, however you should use the escaped character method or heredoc