Home arrow PHP arrow Page 3 - JV’s Power Tips for PHP (2)
PHP

JV’s Power Tips for PHP (2)


In this article Justin explores day to day programming techniques that can help to make a PHP developers life just that little bit easier.

Author Info:
By: Justin Vincent
Rating: 3 stars3 stars3 stars3 stars3 stars / 2
February 02, 2003
TABLE OF CONTENTS:
  1. · JV’s Power Tips for PHP (2)
  2. · The Problem
  3. · Method 1
  4. · Method 2
  5. · Method 3
  6. · Method 4
  7. · Conclusion

print this article
SEARCH DEVARTICLES

TOOLS YOU CAN USE

advertisement
JV’s Power Tips for PHP (2) - Method 1
(Page 3 of 7 )

Anyway, back to the main point. We are in the middle of writing a script to test if the user has selected bold, italic etc. Here is the first (most basic) way of doing this:

<?php

  if ( $_POST['bold'] )
  {
    $_POST['chat'] = "<b>{$_POST['chat']} </b>";
  }

  if ( $_POST['italic'] )
  {
    $_POST['chat'] = "<i>{$_POST['chat']}</i>";
  }

  if ( $_POST['underline'] )
  {
    $_POST['chat'] = "<u>{$_POST["chat']}</u>";
  }

  if ( $_POST['strike'] )
  {
    $_POST['chat'] = "<s>{$_POST['chat']}</s>";
  }

  echo $_POST['chat'];

?>


It's easy to see what is going on here. So I won’t say too much about it. Except that it is worth noting the variable $_POST['chat'] is within {}'s. This means you don’t have to break the "'s with .s!
blog comments powered by Disqus
PHP ARTICLES

- Removing Singletons in PHP
- Singletons in PHP
- Implement Facebook Javascript SDK with PHP
- Making Usage Statistics in PHP
- Installing PHP under Windows: Further Config...
- File Version Management in PHP
- Statistical View of Data in a Clustered Bar ...
- Creating a Multi-File Upload Script in PHP
- Executing Microsoft SQL Server Stored Proced...
- Code 10x More Efficiently Using Data Access ...
- A Few Tips for Speeding Up PHP Code
- The Modular Web Page
- Quick E-Commerce with PHP and PayPal
- Regression Testing With JMeter
- Building an Iterator with PHP

Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 



© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 3 - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials