You are here: Problem getting array values from form « All PHP « IT news, forums, messages
Problem getting array values from form

Posted by Alliss on 10/01/05 11:38

I have a dynamically generated form which produces a series controls like
these.

<input type='submit' name='lastName[]' value=' Brown '>
<input type='submit' name='firstName[]' value=' Bill '>

I end up with about 90 elements in each array.
I submit the form using
<form method="post" action ="<?php echo $PHP_SELF ?> " >

After the form is submitted and I test to find the values in the arrays they
are empty.
I want to be able to insert the individual values from the arrays into a
database table.
I have tried numerous ways to do this but this will give you an idea of what
I am aiming for:
(the value of $insertData is the number of elements in the arrays coming
from the form)

if($insertData){
for($n=0; $n<$insertData; $n++){
$sql = "INSERT INTO contacts (lastName,firstName) VALUES
('$lastName[n]','$firstName[n])";
...

I would be grateful if someone can tell me how I should be submitting and
then reading the values of lastName and firstName.

Al

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация