Question: Putting seperate form elements into an array

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Right now this seems something like solving a rubic's
cube.  While I process, I hope it's alright that i'm
asking here.  I think my quantity of posts have been
high :)

I have these form elements:(these are the names of the
elements)

skill1    sky1     slu1  
skill2    sky2     slu2 
skill3    sky3     slu3
.....     ...      ....

They are being passed as sessions variables:

$_SESSION['f411a'] = $_POST['skill1'];
$_SESSION['f411b'] = $_POST['sky1'];
$_SESSION['f411c'] = $_POST['slu1'];
$_SESSION['f412a'] = $_POST['skill2'];
$_SESSION['f412b'] = $_POST['sky2'];
$_SESSION['f412c'] = $_POST['slu2'];
$_SESSION['f413a'] = $_POST['skill3'];
$_SESSION['f413b'] = $_POST['sky3'];
$_SESSION['f413c'] = $_POST['slu3'];

Perhaps instead of listing them out I should find a
way here to get them into an array.  
Also, none of these are required fields, but if the
user put something in for Skill1 , then they should
input for sky1 and slu1.

Now I need to sort them out for processing into the
database.  I don't think it's wise to check each one.
When they go into the database, each "skill, sky ,
slu"
is a new record.

+---------+----------+---------+--------+
| Record  |  Skill   |  Years  | Used   |
+---------+----------+---------+--------+
| 1001    |  Skill1  |  sky1   |  slu1  |
+---------------------------------------+
| 1002    |  Skill2  |  sky2   |  slu2  |
+---------------------------------------+

Someone partially wrote something out for me.  But I
can't quite understand it.  

for($i=0; $i<5; $i++){
echo ('<br>-'.@$HTTP_SESSION_VARS['f41'.($i+1).'a']);
	if (!empty($HTTP_SESSION_VARS['f41'.($i+1).'a'])){
		$_SESSION('skil', $_SESSION['f41'.($i+1).'a']);
		$_SESSION('yrs', $_SESSION['f41'.($i+1).'b']);
		$_SESSION('used', $_SESSION['f41'.($i+1).'c']);


I see the increment , though I'm not sure why there is
an echo at the start.  f41 comes from nowhere and it
looks like each field has 2 variables. 

Anyway I am seriously trying the figure this out,
apologies for sending it to the list.

Thank you,
Stuart

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux