mmc6e Posted August 18, 2012 Share Posted August 18, 2012 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 Quote Link to comment https://forums.phpfreaks.com/topic/267292-php-coding-for-a-handler/ Share on other sites More sharing options...
MMDE Posted August 18, 2012 Share Posted August 18, 2012 That's HTML and CSS, nothing to do with PHP really... Quote Link to comment https://forums.phpfreaks.com/topic/267292-php-coding-for-a-handler/#findComment-1370550 Share on other sites More sharing options...
tibberous Posted August 18, 2012 Share Posted August 18, 2012 You pretty much need to know html and css before PHP, unless you just want to write command line scripts. But to answer your question: echo "<CENTER><B><FONT SIZE=9 FACE=TAHOMA>Your Email Change was sent successfully"; Will work. Quote Link to comment https://forums.phpfreaks.com/topic/267292-php-coding-for-a-handler/#findComment-1370552 Share on other sites More sharing options...
serien Posted August 18, 2012 Share Posted August 18, 2012 ^ 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! Quote Link to comment https://forums.phpfreaks.com/topic/267292-php-coding-for-a-handler/#findComment-1370557 Share on other sites More sharing options...
mmc6e Posted August 18, 2012 Author Share Posted August 18, 2012 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"; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/267292-php-coding-for-a-handler/#findComment-1370558 Share on other sites More sharing options...
serien Posted August 18, 2012 Share Posted August 18, 2012 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! Quote Link to comment https://forums.phpfreaks.com/topic/267292-php-coding-for-a-handler/#findComment-1370562 Share on other sites More sharing options...
mmc6e Posted August 18, 2012 Author Share Posted August 18, 2012 Thanks. The first example works great. For some reason the 2nd one did not. It gave me an error when the form was submitted. Again thanks for the help, Quote Link to comment https://forums.phpfreaks.com/topic/267292-php-coding-for-a-handler/#findComment-1370564 Share on other sites More sharing options...
Christian F. Posted August 19, 2012 Share Posted August 19, 2012 *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. Quote Link to comment https://forums.phpfreaks.com/topic/267292-php-coding-for-a-handler/#findComment-1370573 Share on other sites More sharing options...
trq Posted August 19, 2012 Share Posted August 19, 2012 Agreed. You should also take a look at semantic naming conventions. Naming a class "form_handler" makes it difficult to use. Quote Link to comment https://forums.phpfreaks.com/topic/267292-php-coding-for-a-handler/#findComment-1370575 Share on other sites More sharing options...
Christian F. Posted August 19, 2012 Share Posted August 19, 2012 I've fixed the classname to something a bit simpler. Though, I don't see why it should make things difficult to use in the first place. Care to elaborate? Quote Link to comment https://forums.phpfreaks.com/topic/267292-php-coding-for-a-handler/#findComment-1370583 Share on other sites More sharing options...
trq Posted August 19, 2012 Share Posted August 19, 2012 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 Quote Link to comment https://forums.phpfreaks.com/topic/267292-php-coding-for-a-handler/#findComment-1370596 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.