Help...

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
Takuma
Forum Regular
Posts: 931
Joined: Sun Aug 04, 2002 10:24 am
Location: UK
Contact:

Help...

Post by Takuma »

OK here's a very simple problem which I don't know how to solve, I think I've read this before but couldn't find that post so here it is.

I have the HTML code like:-

Code: Select all

<form method="POST" action="test.php">
  <input type="text" name="wordї0]">
  <input type="text" name="wordї1]">
  <input type="submit" value="go">
</form>
In test.php do I access the "word" like

Code: Select all

<?php
echo $_POSTї'word']ї0];
echo $_POSTї'word']ї1];
?>
?????


Thanks
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

Array
(
··[word] => Array
····(
······[0] => field #1
······[1] => field #2
····)
)
seems so ;)
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

Have you tried to access it like that by doing some test code? I think you could answer your own question pretty quickly that way.

Mac
User avatar
Takuma
Forum Regular
Posts: 931
Joined: Sun Aug 04, 2002 10:24 am
Location: UK
Contact:

Post by Takuma »

ok, thanks anyway...

P.S. I didn't had time to do it myself when I posted it myself, so I thought it would be quicker to do it this way :wink:
rev
Forum Commoner
Posts: 52
Joined: Wed Oct 02, 2002 3:58 pm
Location: Atlanta, GA

Re: Help...

Post by rev »

Takuma wrote:

Code: Select all

<?php
echo $_POSTї'word']ї0];
echo $_POSTї'word']ї1];
?>
Will work fine in PHP 4.1.0+. In previous versions substitute $_POST with $HTTP_POST_VARS (note: $HTTP_POST_VARS must be referenced as a global within functions and classes, unfortunately -- where $_POST is already referenced for you).
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

Takuma wrote:P.S. I didn't had time to do it myself when I posted it myself, so I thought it would be quicker to do it this way :wink:
Yes but you must admit it is fairly lazy. Next time you have something this easy to test please do it yourself. This is not to say that this is a stupid question, it's just that it would have taken you as long to test it yourself as posting the question here and waiting for an answer took and you definitely have the skills to do your own testing.

Mac
User avatar
Takuma
Forum Regular
Posts: 931
Joined: Sun Aug 04, 2002 10:24 am
Location: UK
Contact:

Post by Takuma »

Sorry... But I do that most of the time, can't help being lazy, I know I got to stop it but... heard. I'll try from next time :twisted:
rev
Forum Commoner
Posts: 52
Joined: Wed Oct 02, 2002 3:58 pm
Location: Atlanta, GA

Post by rev »

I just can't pass on the opportunity...

Takuma, in your own words from viewtopic.php?t=3400
Takuma wrote:I think he can work that out by himself(or herself)...
heh
User avatar
Takuma
Forum Regular
Posts: 931
Joined: Sun Aug 04, 2002 10:24 am
Location: UK
Contact:

Post by Takuma »

:lol:

Have to learn what I said
rev
Forum Commoner
Posts: 52
Joined: Wed Oct 02, 2002 3:58 pm
Location: Atlanta, GA

Post by rev »

We are our own best teachers, no doubt... :) If I made no mistakes I would know very little...

wait, I do know very little. Help!
Post Reply