PHP Tips and Tricks

C++, C#, Java, PHP, ect...
Falken
Posts: 438
Joined: Fri May 08, 2009 8:03 pm

Re: PHP Tips and Tricks

Post 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 :P
--- Game Database ---
For all your game information needs!
Visit us at: http://www.gamedatabase.eu today!
mrmajic
Posts: 117
Joined: Sat Jun 27, 2009 9:37 am

Re: PHP Tips and Tricks

Post 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...
Mr Majic...

Current Project: http://www.deltarealm.net
feedback welcome.
User avatar
hallsofvallhalla
Site Admin
Posts: 12023
Joined: Wed Apr 22, 2009 11:29 pm

Re: PHP Tips and Tricks

Post by hallsofvallhalla »

nice work!

Glad to see PHP treating you so well.
mrmajic
Posts: 117
Joined: Sat Jun 27, 2009 9:37 am

Re: PHP Tips and Tricks

Post by mrmajic »

Image

This is what i ended up with for my hitpoints bar...
Mr Majic...

Current Project: http://www.deltarealm.net
feedback welcome.
User avatar
hallsofvallhalla
Site Admin
Posts: 12023
Joined: Wed Apr 22, 2009 11:29 pm

Re: PHP Tips and Tricks

Post by hallsofvallhalla »

that is very good, i like the style a lot.
User avatar
Noctrine
Posts: 928
Joined: Thu Apr 23, 2009 9:57 pm

Re: PHP Tips and Tricks

Post 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.
Jesse Dorsey
ProjectANI - Lead Developer Person
http://about.me/jessedorsey
User avatar
hallsofvallhalla
Site Admin
Posts: 12023
Joined: Wed Apr 22, 2009 11:29 pm

Re: PHP Tips and Tricks

Post 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.
User avatar
Jackolantern
Posts: 10891
Joined: Wed Jul 01, 2009 11:00 pm

Re: PHP Tips and Tricks

Post by Jackolantern »

I also prefer DIVs and CSS over tables, and they are not that bad with Dreamweaver CS4.
The indelible lord of tl;dr
Falken
Posts: 438
Joined: Fri May 08, 2009 8:03 pm

Re: PHP Tips and Tricks

Post 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 ;)
--- Game Database ---
For all your game information needs!
Visit us at: http://www.gamedatabase.eu today!
mrmajic
Posts: 117
Joined: Sat Jun 27, 2009 9:37 am

Re: PHP Tips and Tricks

Post 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
Mr Majic...

Current Project: http://www.deltarealm.net
feedback welcome.
Post Reply

Return to “Coding”