Create hidden field for variables

Hi I am new for php and i try to fetch the value from db and some fields like to hidden value i try this but its not working need help…

<?php 

    include ("server.php");

	if (isset($_GET['edit'])) {
		$id = $_GET['edit'];
		$update = true;
		$record = mysqli_query($db, "SELECT * FROM info WHERE id=$id");

		if (count($record) == 1 ) {
			$n = mysqli_fetch_array($record);
                       	$name = $n['name'];
			            $address = $n['address'];
                        $move_1 = $n['move_1'];
                           
		}

	}
    ?>
    <html>
<title>form</title>
    <body>
    <form method="post" action="view_records.php" >
      
       <div class="input-group">
		<label>Loan Grant</label>
		<input type="hidden" name="name" value="<?php echo $name; ?>">
	</div>
    <div class="input-group">
           <label>Recommendation</label>
                <select name="move_1">
                <option value="">Select any one</option>
                <option value="Recommended">Recommended</option>
                <option value="Not Recommended">Not Recommended</option>
                 </select>
         </div>
    <body>
    <html>

Welcome to the forums, @sindiyenbalass. What do you mean by “it’s not working”? We need more information - what is not working? Are you getting any errors (Do you have your error reporting turned on?).

1 Like

Firstly thanks for the quick reply.
my overall concept is that I had three type of user admin, user1, user2
there is like an application form that user 1 submit the form then the user2 can edit only the recommended or not recommended and the rest all hidden values to be shown in the form . if I set this one the input value is editable as like user1.
Thats it.

Thanks

I did something like this when I faced a similar situation -

<select>
<option> Show This <option>
<option disabled> Hide me <option>
<option disabled>  Hide me too<option>
</select>

just add the disabled attribute to the options you want to hide and use some css -

select option[disabled] {
    display: none;
}

Great ! I think its difficult but you make it simple
Thanks a lot

Your Welcome

Hi I just notify this when i going to edit the last two fields which i was not disabled the ie( <input type=text ) its doing fine but rest of the field data goes blank, when i view the records in view page.
need help …

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.