Page 2 of 3
Re: PHP Tips and Tricks
Posted: Sun Jul 05, 2009 6:54 pm
by Falken
Jattenalle wrote:Noctrine wrote:You can convert them to gets actually.
Not if the site is properly coded.
If you use $_POST[] or $_GET[] then only that method will work.
Sending $_GET[] variables when a page expect $_POST[] will result in nothing.
There are archaic, outdated, insecure, unsupported ways to just grab data no matter where it's coming from.
But that's a VERY bad idea.
You can use $_REQUEST instead, which fetches data from both GET and POST, but also from Cookies. Altho this isn't a good idea to use due to security issues

Re: PHP Tips and Tricks
Posted: Mon Jul 06, 2009 12:10 pm
by mrmajic
Code: Select all
<tr>
<td width="14%"><font face="Arial">Hitpoints:
<table border="1" width="100" height="10">
<tr>
<td width="100%"><img border="0" src="test1.png" width="<?php echo floor($playerinfo3['hpoints'] / $playerinfo3['maxhp']*100) ; ?>" height="10"></td>
</tr>
you guessed it .. i coded a health bar...
ok so test.png is a 1 pixel wide picture of just the color red .. and the bar is 100 pix wide .. so when you get your percentage that your health is (current health - max health * 100) then that number is how wide the 1pix picture is inside ya graph .. and no crap .. i worked this out myself .. thanks halls .. i knows its messy and sstuff, but u get it...
Re: PHP Tips and Tricks
Posted: Mon Jul 06, 2009 1:28 pm
by hallsofvallhalla
nice work!
Glad to see PHP treating you so well.
Re: PHP Tips and Tricks
Posted: Mon Jul 06, 2009 1:50 pm
by mrmajic
This is what i ended up with for my hitpoints bar...
Re: PHP Tips and Tricks
Posted: Mon Jul 06, 2009 4:43 pm
by hallsofvallhalla
that is very good, i like the style a lot.
Re: PHP Tips and Tricks
Posted: Tue Jul 07, 2009 3:21 pm
by Noctrine
Jattenalle wrote:Even if positioning DIVs is a fucking pain in the ass...
Never has a truer statement...
But yeah, even when using tabular data. The trend has been going to a more CSS oriented site. I had a really nice site that showed why you should only use tables for tabular data but I can't seem to find it right now.
Re: PHP Tips and Tricks
Posted: Tue Jul 07, 2009 4:12 pm
by hallsofvallhalla
i hate tables with a passion BUTTT you can use the current table you have mixed with css and div tags to make it look real nice.
I personally love div tags and css sheets but like Jatt said its a pain sometimes. Mainly when you are trying to center the whole page around different size monitors and browsers.
Re: PHP Tips and Tricks
Posted: Tue Jul 07, 2009 6:46 pm
by Jackolantern
I also prefer DIVs and CSS over tables, and they are not that bad with Dreamweaver CS4.
Re: PHP Tips and Tricks
Posted: Tue Jul 07, 2009 10:01 pm
by Falken
Jattenalle wrote:Jackolantern wrote:I also prefer DIVs and CSS over tables, and they are not that bad with Dreamweaver CS4.
Pfft, real men code their sites in Notepad++
Exactly! Best website maker ever

Re: PHP Tips and Tricks
Posted: Thu Jul 09, 2009 11:59 am
by mrmajic
Quick question :: is just using $_SESSION['strings'] / rather than using $_POST's alright .. just makes it easier to call "global" variables that have already been put into the session...???\
\I hope i said that properley