Jump to content
Sign in to follow this  
BrainPill

connect session variable in html form loop

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

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...