Jump to content

connect session variable in html form loop


BrainPill

Recommended Posts

 This script shows the fetched data in a modify form. 
    In the old situation I used rec_num wich was corresponding to the record number in the database.table
    For security reasons I added a uniqid column to the table.  

   So not like under with an input hidden attribute for uniqid.

    If possible I would like it to be stored in a session variable. This is doable like above, but outside the foreach 
    loop only the last value is stored.
    
    How to connect every single uniqid value (for multiple records!) to the separated rec_num without users being able to see the uniqid?

 

$value = $_POST['checkbox_values'];


		 $i=0;
		foreach ($value as $values) {   
			if (++$i > 10) break ; 
		 
		$element = explode(" / " , $values);
		 
		 
		$_SESSION['uniqid'] = $element[1];
		var_dump($_SESSION['uniqid']);
		 
		 ?>
		 <form action = "" method="post">
			
		<input type ="hidden" name="rec_num[]"   value="<?php echo $element[0] ;?>" >	
		<!--<input type ="hidden"   name="uniqid[]"    value="<?php echo $element[1] ;?>"  >-->
		<input type ="text"   name="value1[]"    value="<?php echo $element[5] ;?>"    >	
		<input type ="text"   name="value2[]"    value="<?php echo $element[6] ;?>"    >	
		<input type ="text"   name="value3[]"    value="<?php echo $element[7] ;?>"   >		
		<input type ="text"   name="value3[]"    value="<?php echo $element[8] ;?>"   >	
			
			<br>
			
			
			<?php 
			}


		?><br>
		<input type="submit" name="send" value="Modify ">
		 </form>

 

Edited by BrainPill
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...