NYCPHP Meetup

[nycphp-talk] How to pass array when click on "submit" ?

Fernando Gabrieli fgabrieli at gmail.com
Mon Jan 26 23:38:00 EST 2009


chad, when posted the arrays should be available using $_POST['name'],
$_POST['position'], etc

try doing print_r($_POST['name']) to check this

i am not seeing an input type="submit" on your form...which should be there
if the user is submitting everything after filling the fields

fernando

On Tue, Jan 27, 2009 at 12:54 AM, chad qian <nynj.tech at hotmail.com> wrote:

>  In "tbody",I can add or remove more
> "name[]","position[]","city[]","state[]" and "zip[]" through "add" or
> "remove" buttons.
> On "create.php" page, I expect to show all like:
> 1.
> name
> position
> city
> state
> zip
> 2.
> name
> position
> city
> state
> zip
> 3.
> name
> position
> city
> state
> zip
> ----------
> --------
> --------
>
> How to program php script to pass all these above
> information?"name","position","city","state" and "zip" are all array.
>
> Thanks!
>
> chad
>
> <form name="form1" method="post" action="create2.php">
> <tr>
> <td><strong>Step2: Board of directors:(Must have at least
> one)</strong></td>
> <td>&nbsp;</td>
> </tr>
> <tbody id="dynamic_table_body">
> <tr>
> <td><label>Name:</label></td>
> <td> <input type="text" name="bn[]" id="bn" /></td>
> </tr>
> <tr>
> <td>Position:</td>
> <td><label>
> <select name="select[]" id="select">
> <option value="president" selected>president</option>
> <option value="vice president">vice president</option>
> <option value="secretary">secretary</option>
> <option value="others">others</option>
> </select>
> </label></td>
> </tr>
> <tr>
> <td>City:</td>
> <td><label>
> <input type="text" name="city[]" id="city" />
> </label></td>
> </tr>
> <tr>
> <td>State:</td>
> <td><label>
> <input type="text" name="state[]" id="city" />
> </label></td>
> </tr>
> <tr>
> <td>Zip:</td>
> <td><label>
> <input type="text" name="zip[]" id="textfield3" />
> </label></td>
> </tr>
> <tr>
> <td colspan="2"><button type="button" onClick="AddRow ();">Add
> </button></td>
> </tr>
> </form>
>
> ------------------------------
> Windows Live™ Hotmail(R):…more than just e-mail. Check it out.<http://windowslive.com/explore?ocid=TXT_TAGLM_WL_t2_hm_justgotbetter_explore_012009>
>
> _______________________________________________
> New York PHP User Group Community Talk Mailing List
> http://lists.nyphp.org/mailman/listinfo/talk
>
> http://www.nyphp.org/show_participation.php
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20090127/24693c98/attachment.html>


More information about the talk mailing list