| | |
problems with htmlentities(noob question)
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
•
•
Join Date: Sep 2009
Posts: 9
Reputation:
Solved Threads: 0
Hey, htmlentities doesn't work in this code of mine, someone know why?
Check line 11-14
Thanks.
Anyone wants to add me to msn? mzm_mc@hotmail.com
good coder or not, IDC. Just need some coding buddies =)
Check line 11-14
Thanks.
PHP Syntax (Toggle Plain Text)
<html> <head> <title> Welcome <?php echo $_GET['name']; ?> </title> </head> <body bgcolor="<?php echo $_GET["favcolor"]; ?>"? <h1> Welcome <?php echo $_GET['name']; ?> </h1> <br /> <?php foreach ($_GET as $key => $verdi) { $verdi = htmlentities($verdi); $key = htmlentities($key); } echo "You live in "; echo $_GET['country']; echo ", "; echo $_GET['city']; echo " And your favorite color is "; switch ( $_GET['favcolor'] ) { case "#ff0000"; $favcolortext="Red"; break; case "#8bcdff"; $favcolortext="Blue"; break; case "#fff600"; $favcolortext="Yellow"; break; case "#0cff00"; $favcolortext="Green"; break; case "#a200ff"; $favcolortext="Purple"; break; case "#6000ff"; $favcolortext="Violet"; break; case "#ff68e1"; $favcolortext="Pink"; break; case "#fbfadd"; $favcolortext="Vanillia"; break; case "#730404"; $favcolortext="Dark Red"; break; case "#10057a"; $favcolortext="Dark Blue"; break; case "#157a05"; $favcolortext="Dark Green"; break; case "#17bb9e"; $favcolortext="Cyan"; break; case "#40f0fb"; $favcolortext="Baby Blue"; break; } echo "$favcolortext."; ?> </body> </html>
Anyone wants to add me to msn? mzm_mc@hotmail.com
good coder or not, IDC. Just need some coding buddies =)
You are just setting the value to a variable.
You should do something like this:
You should do something like this:
PHP Syntax (Toggle Plain Text)
foreach( $_GET as $key => $val ) { $_GET[$key] = htmlentities( $val ); }
Google is your friend.
Use [code] tags.
If you have found a solution to your problem, please mark the thread as SOLVED.
Use [code] tags.
If you have found a solution to your problem, please mark the thread as SOLVED.
•
•
Join Date: Sep 2009
Posts: 9
Reputation:
Solved Threads: 0
Thanks alot, it helped.
Could you explain me one more thing, my books is telling me to do it like this:
And it says " So on..." the books doesn't tell me more about this.
My question is what is this "<>" function called and what does it do?
or what should I search on google to get more info about this.
Thanks.
Could you explain me one more thing, my books is telling me to do it like this:
PHP Syntax (Toggle Plain Text)
foreach ($_GET as $key => $val) { $val = htmlentities($val); if ( $key <> "name")
My question is what is this "<>" function called and what does it do?
or what should I search on google to get more info about this.
Thanks.
Google is your friend.
Use [code] tags.
If you have found a solution to your problem, please mark the thread as SOLVED.
Use [code] tags.
If you have found a solution to your problem, please mark the thread as SOLVED.
![]() |
Similar Threads
- Javascript problems with IE6 (JavaScript / DHTML / AJAX)
- WinAPI noob question (C++)
- Total noob question (Database Design)
- Noob with a question (IT Professionals' Lounge)
- Question (Networking Hardware Configuration)
- noob question (C)
- Noob question about Defining and Declaring. (C++)
- NOOB question , graphical tiles (C++)
- What exploit are they using? (Web Browsers)
Other Threads in the PHP Forum
- Previous Thread: A warning problem
- Next Thread: How do I install Sablotron with PHP?
| Thread Tools | Search this Thread |
Tag cloud for PHP
.htaccess access ajax apache api array beginner binary broken cakephp checkbox class cms code cron curl database date directory display download dynamic echo email encode error fcc file files folder form forms function functions google howtowriteathesis href htaccess html image images include insert integration ip java javascript joomla ldap limit link login loop mail menu methods mlm mod_rewrite multiple multipletables mysql oop open parse paypal pdf php problem query radio random recursion regex remote script search server sessions sms soap source space speed sql structure syntax system table template tutorial update upload url validation validator variable video web xml youtube






