Jump to content

PHP coding for a handler


mmc6e

Recommended Posts

The last 3 lines of my "form handler" are:

 

if($sent) {print "Your Email Change was sent successfully"; }

else

{print "We encountered an error sending your mail"; } ?>

 

When the Handler is executed it prints "Your Email Change was sent successfully"

My question is what do I need to add to have the message centered, bolded and with a specific font and/or size?

Thanks

Link to comment
https://forums.phpfreaks.com/topic/267292-php-coding-for-a-handler/
Share on other sites

^ That's interesting style, tibberous.  I've never seen that sort of formatting  :) learn something new every day!

 

Aye, as other say, those are html/css properties.  http://w3schools.com/ has some really awesome tutorials and advice for beginners to these languages, if you want further tips.  HTML is used to create things and display them on a page, CSS styles those things.  If the above is all you need, though, awesome.  If you want to learn more, though, check out the w3 website!

Thanks for the help.

I added the code but am not getting an error when the form is submitted.

 

The last 3 lines now look like this:

 

if($sent) {print echo "<CENTER><B><FONT SIZE=9 FACE=TAHOMA>Your Email Change was sent successfully" }

else

{print "We encountered an error sending your mail"; } ?>

 

 

try this

 

if($sent) {echo "<div align='center'><strong><p style='font-family:tahoma;font-size:9px;' >Your Email Change was sent successfully</p></strong></div>"; }
else
{echo "We encountered an error sending your mail"; } ?>

 

You don't want to use both 'print' and 'echo', as they both do the same thing =] just use one or the other.  this version also involves the html/css version of positioning and font styling

 

EDIT: Put in

if($sent) {echo "<CENTER><B><FONT SIZE=9 FACE=TAHOMA>Your Email Change was sent successfully" }
else
{print "We encountered an error sending your mail"; } ?>

and it worked correctly also.  so whichever you prefer!

*Sigh*

 

CSS code:

.message {
    font-weight: bold;
    text-align: center;
    font-family: tahoma;
    font-size: 9px;
}

 

PHP/HTML code:

if ($sent) {
    echo '<p class="message">Your email change was sent successfully</p>';
}

 

To those who've tried to help: PLEASE try to post valid HTML & CSS, and adhere to the best practise guidelines. We don't need more crappy code on the net after all.

Using a name like form_handler locks that class down to be used with the form handler. The point if css classes is that they are (or should be) re-usable. To make them re-usable while having names that still make sense, they should be named as generically as possible. They should be named by what they *do* not what elements they should attach to. ie; I would be inclined to name said class bold-centered

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.