Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > PHP/MySQL > PHP How-To
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
PHP How-To Post your "How do I do this with PHP?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the PHP How-To section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old December 31st, 2005, 12:50 AM
Registered User
 
Join Date: Dec 2005
Location: Todd, NC, USA.
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to hillbilly geek
Default Array woes

I'm a newbie, working with php4.

I'm passing arrays from a form: a series of variables with the same
name like: Child[] and Age[]

I'm capturing them with:
        $Child[] = array($_POST['Child[]']);
        $Age[] = array($_POST['Age[]']) ;

then, I'm using:

 <?php
$Count=0 ;
echo "<h3>Registering $numChildren Children</h3>" ;
do
{
                echo "<p>$Child[$Count], Age $Age[$Count], $Gender[$Count]<p>" ;
                echo "<p>Info: " . $Info[$Count] . "<p>" ;
                $CheckEmpty = "$Child[$Count]" ;
                $Count="$Count+1" ;

} while ($CheckEmpty!="") ;

if ($Count==1) echo "Not Applicable" ;
?>
However, I get this result on the page: (for 2 entries):

Array, Age Array, Array
Info: Array

, Age ,
Info:

In other words: the first set of values are replaced with "Array"

And the second set of values don't show up.
I also tried it with three sets, and the third set didn't register at all
Help? Thanks!

---
Descartes goes into a restaurant and orders a cup of coffee. He sits for a while, drinking his coffee and reading the paper. A little while later, the waitress comes by and asks him if he would like another cup. He says "I think not" and disappears...
Reply With Quote
  #2 (permalink)  
Old December 31st, 2005, 03:21 PM
Friend of Wrox
 
Join Date: Mar 2004
Location: Bhopal, MP, India.
Posts: 357
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to anshul
Default

Many times, we need to reset() arrays before using them. I'm though, not sure if it solves your problem ..

`~@#\^%&*/\.<.\/-|+|_!:;..=?>
Students' finances
Reply With Quote
  #3 (permalink)  
Old January 8th, 2006, 12:28 AM
Friend of Wrox
 
Join Date: Dec 2004
Location: London, London, United Kingdom.
Posts: 154
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I'm not too sure how you "POST" an array to be honnest??
Its 4am here so i'm going to make an observation cause I don't want to create an array right now ;)
Did you try:
<?php
$Child[]=$_POST['Child[]'];
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Installation woes gcallaway Beginning PHP 9 March 31st, 2008 07:05 PM
onClick woes DennyLoi Javascript How-To 1 November 3rd, 2007 01:13 PM
Form woes komputatek Access 2 March 15th, 2005 11:47 AM
Installation woes mattm BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 2 June 26th, 2003 03:40 PM



All times are GMT -4. The time now is 01:52 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.