Current location: Hot Scripts Forums » Programming Languages » PHP » how to get multiple form values as variables in PHP?


how to get multiple form values as variables in PHP?

Reply
  #1 (permalink)  
Old 03-06-10, 11:22 AM
SoftDux SoftDux is offline
Newbie Coder
 
Join Date: Mar 2008
Location: Johannesburg,South Africa
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
how to get multiple form values as variables in PHP?

Hi,

Can someone please help me with this?

I have a form, which is dynamically build from a database, as follows:

ID ---- Username ------Visit ------ Reason
| | | |
12 John <select box> <text field>
8 Ann <select box> <text field>
97 Peter <select box> <text field>
35 Collin <select box> <text field>



So, basically there's an ID & username that's being pulled from the DB. This list is dynamic, depending on various factors so the length will differ every time.

Now, I need to save this info into a different table, but only the "ID", "Visit" and "Reason" fields' date.
The problem is, when I submit this form to the script, all field are submitted as variables and I need to extract those variable values. But, how?

I have the following (slightly modified so far, but it isn't helpful:



PHP Code:

<?PHP


$userids 
JRequest::getVar'userid' );
$userchecks JRequest::getVar'check' );
$reasons JRequest::getVar'reason' );

if (isset(
$userids)) {
        foreach(
$userids as $userid ) {
            echo 
'<i>UserID:</i> '.$userid.' <i>Visit:</i> '.$usercheck.' <i>Reason: </i>'.$reason.'<BR>';
        }
}

From here, the "userid" field get returned fine, but the "usercheck" & "reason" variables return as empty values. How do I get those values as well, for that row?
Reply With Quote
  #2 (permalink)  
Old 03-06-10, 04:45 PM
wirehopper's Avatar
wirehopper wirehopper is offline
-
 
Join Date: Feb 2006
Posts: 2,515
Thanks: 20
Thanked 109 Times in 106 Posts
Add s to usercheck and reason

PHP Code:

echo '<i>UserID:</i> '.$userid.' <i>Visit:</i> '.$userchecks.' <i>Reason: </i>'.$reasons.'<BR>'
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
deleting multiple records from MYSQL database using PHP sujata_ghosh PHP 5 06-04-09 03:07 AM
question about sending checkboxes values to php script? darksniperx PHP 3 10-13-07 01:03 PM
Problem with FormMail script for simple contact form amang Perl 2 09-21-07 07:59 PM
Ajax....changing values of php variables sushi4664 JavaScript 1 08-09-07 12:04 AM


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