Forum Moderators: coopster
But i need to have 3 fields on a form go together, 15 times.
example, name email cell but the form will have 15 lines of that.
do i have seperate array for each field or make them multidimensional?
name[], email[], cell[] or do i need something[name], something[email].............
Hope this makes sense.
Thank you.
As then you can like everything together using the numeric keys.
It may help you to build a test array with the data you want and run it through the code below. As this will help you to see what the contents of that array looks like.
<?php
$test = array(array('bob', 'bob@example.com', '000000000'), array('fred', 'fred@example.com', 111111111));
// cell number as a string so you dont just get 0
$test1 = array('bob' => array('bob@example.com', '000000000'), 'fred' => array('fred@example.com', 111111111));
echo '<pre>TEST<br />';
[url=http://uk3.php.net/manual/en/function.print-r.php]print_r[/url]($test);
echo '</pre>';
echo '<pre>TEST1<br />';
print_r($test1);
echo '</pre>';
?> Your loop could look something like -
foreach ($test as $v) {
$q = "INSERT INTO <table_name> (name, email, cell) VALUES $v[0], $v[1], $v[2];";
// mysql_query
}