News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

PHP Lesson 11 - using user input

Started by Parham, September 08, 2003, 11:24:01 PM

Previous topic - Next topic

[Unknown]

Try using print_r.  In other words, do:

print_r($_POST);

That way, you can see what is being submitted, if anything.

-[Unknown]

Ardenn

I fixxed it.. It was another silly typo..  Thank you so much for your help.  I've only been studying this for a day and Im pretty amazed about how easy it is.  Its just that I have to keep using it to really learn it.


Ardenn // Traxxus
http://www.twinwand.com
D&D Play by Post Community Looking for Players and DM's

pulpitfire

was the error that you need to put a spacer between the variable and the <br> tag?

e.g.

echo "red box: $yellowbox ' . <br>";

because otherwise, it might interpret the <br> tag as part of your variable $yellowbox, and come up with nothing?

[Unknown]

Quote from: Ardenn on December 04, 2003, 02:47:15 PM
I fixxed it.. It was another silly typo..  Thank you so much for your help.  I've only been studying this for a day and Im pretty amazed about how easy it is.  Its just that I have to keep using it to really learn it.




Ahh, don't sweat.  I'm considered a pro here.... (I think they say it just so I'll keep working on SMF :P.) and I make just as many, if not more typos.  So you're already (according to those who say I'm a pro...) part way there!

Yeah... takes work like everything else, but.. at least in my opinion, it's fun.  Then again, I also actually like Caclulus, Networking, Physics, Web Design, Economics, and several other VERY nerdy things.  And I think they are fun too.

Maybe that's why I don't have a girlfriend... run while you still can!

-[Unknown]

Ardenn

The error was a left over for something I did to -TRY- to fix the thing in the first place.

I keep 2 sets of files.  Those that are reference and those that I play with.  The reference are direct copies of the code from here  in the "IF" lesson and also in the HTML form.

I just happen to double check on my "play" files that the form was GET and the PHP script was POST.  So Stupid mistake 1 resolved.

The next thing is that I changed the variable name in the HTML to name="name" just like I had seen it on another example, and left the PHP script at $_POST["color"].  Stupid mistake number 2 resolved.

I did indeed make the mistake color="color" and once all three were resolved it worked like a charm.  It was just alot of "lil" mistakes.
Ardenn // Traxxus
http://www.twinwand.com
D&D Play by Post Community Looking for Players and DM's

[Unknown]

Quote from: pege on December 04, 2003, 03:00:06 PM
was the error that you need to put a spacer between the variable and the <br> tag?

e.g.

echo "red box: $yellowbox ' . <br>";

because otherwise, it might interpret the <br> tag as part of your variable $yellowbox, and come up with nothing?

That's why I recommend you don't go through the headache and problems, and rather just do this:

echo 'red box: ', $yellowbox, '<br />';

  - most languages don't have interpolation, so it's a bad habit to get into.
  - interpolation is not only slow, but often confusing - especially with arrays.
  - I always prefer to use xhtml (<br />) rather than html since it is backwards compatible. (<br>)

-[Unknown]

Bartrainer

I installed php as a module. My question is: Which php.ini file is the one that is used to determine the behaviors of php? I have one in the modules folder in apache, and i have one in the php folder.

These tutorials are great, i'm glad i found them.
Everyone that says "it can't be done" is followed by someone that just did it.  The possibilities are as Powerful as your imagination...

"There are No bad cocktails, just bad drinkers."

[Unknown]

If you have a phpinfo, it will tell you where it's looking for php.ini.

-[Unknown]

Bartrainer

Awesome, it's looking for it in Apache2, does that mean i should delete all the other php.ini files?

Thanks.
Everyone that says "it can't be done" is followed by someone that just did it.  The possibilities are as Powerful as your imagination...

"There are No bad cocktails, just bad drinkers."

[Unknown]

Probably the "safest" idea.  But it shouldn't be a problem.

-[Unknown]

Grek.Kamchatka

How to forbid repeated pressing the button "submit"? In base one value, after the first pressing should be brought only, the field is cleared and by pressing the button "submit" the script should not work.! isset does not approach.

[Unknown]

You have to use JavaScript to prevent them from hitting submit multiple times, usually.

-[Unknown]

Grek.Kamchatka

Thanks, I tried, but it has not turned out. Have you an example of a script?

Advertisement: