/    Sign up×
Community /Pin to ProfileBookmark

Insert Array Data

Hi,

How do I insert data into an array, upon clicking on different links?

[B]Link Examples:[/B]

add.php?name=david
add.php?name=george
add.php?name=lisa

If all links are clicked, the array should be populated with the three names (david, george, lisa)

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@ploceusFeb 15.2008 — The 'name' variable is not an array. When you use HTML form, you type in the name and send (by clicking) information to server. So it does not make sense to submit an array of names. The server can collect individual names (using $_GET['name']) from users and do something with it, say put in database.
Copy linkTweet thisAlerts:
@TheRaveFeb 15.2008 — Hi,

How do I insert data into an array, upon clicking on different links?

[B]Link Examples:[/B]

add.php?name=david

add.php?name=george

add.php?name=lisa

If all links are clicked, the array should be populated with the three names (david, george, lisa)[/QUOTE]


Dysan, PHP scripts are not persistant. As in variables (including ones which hold arrays) do not retain their values between executition. Every time you run the add.php script the array will start off empty. You need to do something with the data so you can access it next time the script is executed. Either you can put them in a plain file or as ploceus said in a database. Then your array can be filled up from the database if/when necessary.
×

Success!

Help @Dysan spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...