LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 08-09-2009, 05:05 PM   #1
koosha
LQ Newbie
 
Registered: Jun 2009
Distribution: Debian GNU/Linux
Posts: 29

Rep: Reputation: 0
Question PHP: Converting a PHP array into an HTML array


Hi.
------------
I'm writing a PHP program. I've encountered a problem; in the following code I try to pass $_POST['delete'] which is an array as the value of a hidden input to some form, but it doesn't do so.

In fact, there's something wrong with converting PHP array into HTML array.

I'm sure that $_POST['delete'] is not null and is a real array.

echo '<input type="hidden" name="delete[]" value="'.$_POST['delete'].'" />';

Please help me!
 
Old 08-10-2009, 08:04 AM   #2
j-ray
Senior Member
 
Registered: Jan 2002
Location: germany
Distribution: ubuntu
Posts: 1,419

Rep: Reputation: 99
1. there are no html arrays.
2. multiple values are possible in select fields but I don't think they are possible in type='hidden'.
 
Old 08-10-2009, 11:58 AM   #3
Wim Sturkenboom
Senior Member
 
Registered: Jan 2005
Location: Roodepoort, South Africa
Distribution: Slackware 10.1/10.2/12, Ubuntu 12.04, Crunchbang Statler
Posts: 3,786

Rep: Reputation: 282Reputation: 282Reputation: 282
Possible solution will be to keep them in a session variable.
 
Old 08-11-2009, 03:44 AM   #4
j-ray
Senior Member
 
Registered: Jan 2002
Location: germany
Distribution: ubuntu
Posts: 1,419

Rep: Reputation: 99
or make the value of the hidden field a list of array elements separated by a separator and split that in the next request

$val = $e[0]."-_-".$e[1]."-_-".$e[2]."-_-".$e[3];
 
Old 08-11-2009, 08:47 AM   #5
koosha
LQ Newbie
 
Registered: Jun 2009
Distribution: Debian GNU/Linux
Posts: 29

Original Poster
Rep: Reputation: 0
OK. Thanks everybody. I use session variable. That solved my problem.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP Array? delamatrix Programming 4 05-05-2009 06:50 PM
Can't use my PHP array. rblampain Programming 4 06-23-2006 07:19 AM
defining an array in html template to be used by php mohtasham1983 Programming 2 01-28-2006 04:23 PM
passing an array from html-forms to php prabhatsoni Linux - Software 2 06-04-2005 12:11 AM
php array gui10 Programming 2 03-26-2002 02:07 AM


All times are GMT -5. The time now is 09:02 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration