Current location: Hot Scripts Forums » Programming Languages » PHP » multiple forms


multiple forms

Reply
  #1 (permalink)  
Old 12-26-08, 01:37 PM
dami dami is offline
New Member
 
Join Date: Dec 2008
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
multiple forms

Pls I need help here! I have multiple forms on a single page and each is supposed to send a distinct value to php script but when i click on submit, only the value in the last form gets to the php script. but i want each one to get to the script depending on which one i click. Pls i anticipate ur response. thanks
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 12-26-08, 02:35 PM
DAL's Avatar
DAL DAL is offline
Code Master
 
Join Date: Jun 2003
Location: North East England/UK
Posts: 874
Thanks: 0
Thanked 0 Times in 0 Posts
I think I remember running into this problem and I was advised (on here I think although I'm not sure) that this really wasnt the route to go down. Make one form and submit a $_POST array if you want access to the same fields;

HTML Code:
<input type="text" name="YourField[]" id="YourField" value="Whatever">
Then access them via the php by doing the following
PHP Code:

$MyArray $_POST['YourField'];
foreach(
$MyArray as $var){
    echo 
$var."<br>";
}

#or use;

echo "<pre>";
print_r($_POST['YourField']);
echo 
"</pre>"
This should work.

Cheers
Dal
__________________
"once upon a midnight dreary, while i pron surfed, weak and weary, over many a strange and spurious site of 'hot xxx galore'. While i clicked my fav'rite bookmark, suddenly there came a warning, and my heart was filled with mourning, mourning for my dear amour," 'Tis not possible!", i muttered, "give me back my free hardcore!" quoth the server, 404."
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
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 On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] multiple forms in a single page id10tn00b HTML/XHTML/XML 2 10-09-08 12:26 AM
How to write a .csv file with data from multiple forms? ajinc Script Requests 2 10-04-08 07:00 AM
Register user with multiple forms sugarplum PHP 2 10-25-05 01:45 PM
Databases and multiple forms JagerKatze Windows .NET Programming 0 10-12-04 10:58 PM
Multiple forms to email and db radarman012000 ASP 0 08-08-04 09:28 PM


All times are GMT -5. The time now is 05:07 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.