Jump to content


Photo

Array help


  • Please log in to reply
1 reply to this topic

#1 zwebm

zwebm
  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 01 June 2006 - 03:14 AM

Im very new at PHP and have created very simple scripts. is it possoble to add more variables to arrays from a HTML form? i have a simple array like the following...

$game_title = array("Airfox",
"Adrenalin Challenge",
"War Bears",
"Alpha Bravo Charlie",
"A Blast",
"Adventures of Bibo II",
"Air Hockey",
"ALIAS",
"ALIAS 2");

how would i have an HTML form add anothor variable to that array?

#2 samshel

samshel
  • Members
  • PipPipPip
  • Advanced Member
  • 837 posts

Posted 01 June 2006 - 05:31 AM

You can use:

$game_title[] = $_POST['new_element'];

where the new_element is the input submitted....

However if you need to populate the array over several submits...you need to store the original array as arrays cannot be stored across pages...
Cheers,
SamShel
-----------------------------------------------
--: FUTURE IS LINUX :--
-----------------------------------------------




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users