Jump to content


Photo

forms and arrays?


  • Please log in to reply
3 replies to this topic

#1 pvtpyro

pvtpyro
  • Members
  • PipPip
  • Member
  • 12 posts

Posted 29 August 2006 - 11:02 PM

I'm having a little trouble. I will start by showing what I have done.

i have an html form. here's part of it:
    <select name="bgcolor">
      <option value="000000">Black</option>
      <option value="FFFFFF">White</option>
      <option value="CCCCCC">Gray</option>
    </select>

the forms action is to a php file. this code works just peachy.
ImageFill($image, 0, 0, fromhex('ff0099'));

i would like to insert bgcolor from my form in place of ff0099 in the php part. But the only method I know doesn't work.
ImageFill($image, 0, 0, fromhex($_POST['bgcolor']));

can someone help me with this?

#2 kenrbnsn

kenrbnsn
  • Staff Alumni
  • Advanced Member
  • 8,235 posts
  • LocationHillsborough, NJ, USA

Posted 29 August 2006 - 11:16 PM

How doesn't it work? Your code snippet looks fine as long as the method in your form is "POST", if it is "GET" or missing you need to use the $_GET array not the $_POST array.

Ken

#3 pvtpyro

pvtpyro
  • Members
  • PipPip
  • Member
  • 12 posts

Posted 29 August 2006 - 11:22 PM

Yeah, I'm using POST.
I'm using the same method for my other form elements, and they all work fine.
it seems that because there's content before and after my $_POST['bgcolor'] that it's not working. I've tried single quotes, double quotes. nothings working.

#4 pvtpyro

pvtpyro
  • Members
  • PipPip
  • Member
  • 12 posts

Posted 29 August 2006 - 11:26 PM

Oh wait! I'm sorry. This is the second time today I've corrected my own mistakes.

I am sooo sorry for wasting time. I've never done something right on my own before!  :D




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users