Advertisement:

Author Topic: PHP Lesson 11 - using user input  (Read 51437 times)

Offline [Unknown]

  • SMF Friend
  • SMF Master
  • *
  • Posts: 36,102
  • Gender: Male
Re: PHP Lesson 11 - using user input
« Reply #20 on: December 04, 2003, 02:04:32 PM »
Try using print_r.  In other words, do:

print_r($_POST);

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

-[Unknown]

Offline Ardenn

  • Jr. Member
  • **
  • Posts: 108
  • Gender: Male
  • Im a PHP newb
    • Twinwand D&D Forums
Re: PHP Lesson 11 - using user input
« Reply #21 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.


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

Offline pulpitfire

  • Sophist Member
  • *****
  • Posts: 1,132
  • Gender: Male
  • This is what the php parser looks like.
    • Pulpitfire Devotionals
Re: PHP Lesson 11 - using user input
« Reply #22 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?

Offline [Unknown]

  • SMF Friend
  • SMF Master
  • *
  • Posts: 36,102
  • Gender: Male
Re: PHP Lesson 11 - using user input
« Reply #23 on: December 04, 2003, 03:00:07 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]

Offline Ardenn

  • Jr. Member
  • **
  • Posts: 108
  • Gender: Male
  • Im a PHP newb
    • Twinwand D&D Forums
Re: PHP Lesson 11 - using user input
« Reply #24 on: December 04, 2003, 03:08:35 PM »
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

Offline [Unknown]

  • SMF Friend
  • SMF Master
  • *
  • Posts: 36,102
  • Gender: Male
Re: PHP Lesson 11 - using user input
« Reply #25 on: December 04, 2003, 03:49:59 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]

Offline Bartrainer

  • Jr. Member
  • **
  • Posts: 146
  • Gender: Male
  • PHP: What do you want to do?
    • Online Bartending School
Re: PHP Lesson 11 - using user input
« Reply #26 on: April 16, 2004, 08:20:40 PM »
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."

Offline [Unknown]

  • SMF Friend
  • SMF Master
  • *
  • Posts: 36,102
  • Gender: Male
Re: PHP Lesson 11 - using user input
« Reply #27 on: April 16, 2004, 10:16:21 PM »
If you have a phpinfo, it will tell you where it's looking for php.ini.

-[Unknown]

Offline Bartrainer

  • Jr. Member
  • **
  • Posts: 146
  • Gender: Male
  • PHP: What do you want to do?
    • Online Bartending School
Re: PHP Lesson 11 - using user input
« Reply #28 on: April 16, 2004, 10:35:32 PM »
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."

Offline [Unknown]

  • SMF Friend
  • SMF Master
  • *
  • Posts: 36,102
  • Gender: Male
Re: PHP Lesson 11 - using user input
« Reply #29 on: April 16, 2004, 11:45:31 PM »
Probably the "safest" idea.  But it shouldn't be a problem.

-[Unknown]

Offline Grek.Kamchatka

  • Full Member
  • ***
  • Posts: 590
  • Gender: Male
    • My World - My Soarer!
Re: PHP Lesson 11 - using user input
« Reply #30 on: August 06, 2005, 05:29:15 PM »
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.

Offline [Unknown]

  • SMF Friend
  • SMF Master
  • *
  • Posts: 36,102
  • Gender: Male
Re: PHP Lesson 11 - using user input
« Reply #31 on: August 06, 2005, 10:16:14 PM »
You have to use JavaScript to prevent them from hitting submit multiple times, usually.

-[Unknown]

Offline Grek.Kamchatka

  • Full Member
  • ***
  • Posts: 590
  • Gender: Male
    • My World - My Soarer!
Re: PHP Lesson 11 - using user input
« Reply #32 on: August 06, 2005, 11:15:40 PM »
Thanks, I tried, but it has not turned out. Have you an example of a script?