NYCPHP Meetup

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

Zakir Tariverdiev zakir_tariverdiev at yahoo.com
Tue Jan 27 19:44:40 EST 2009


OnClick=AddRow()"... are you trying to send a JavaScript array to the server?
This is not really a PHP issue. But check out the following link, 
http://www.coderanch.com/t/120794/HTML-JavaScript/sending-javascript-array-server
it might help.

Also, note that your City and State <input tags> are enclosed inside <label>, I don't think that was intentional on your part. 


--- On Mon, 1/26/09, chad qian <nynj.tech at hotmail.com> wrote:
From: chad qian <nynj.tech at hotmail.com>
Subject: [nycphp-talk] How to pass array when click on "submit" ?
To: talk at lists.nyphp.org
Date: Monday, January 26, 2009, 10:54 PM




#yiv160178222 .hmmessage P
{
margin:0px;padding:0px;}
#yiv160178222 {
font-size:10pt;font-family:Verdana;}


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®:…more than just e-mail.  Check it out. 
_______________________________________________
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/9a9ceefc/attachment.html>


More information about the talk mailing list