I know how to do basic forms. What I want to do is to pass a set value as a hidden field to accompany an input text value, and have both values entered in the database record.
You can see in the code below that the form asks for names for up to six student groups, such as "Year7", "Year8", "Year9" and so on. What I want my form to do is to post the accompanying input name (in this case "group1", "group2" and so on) as a hidden field to another column in the same record, so that I can search the records on this hidden field.
I hope I've explained this OK.

<table width="750" align="center" cellpadding="4">
                    <form action="admin_login.php" method="post" enctype="multipart/form-data">
                      <tr>
                        <td><div align="right"><font size="-1">Student Group 1:&nbsp;&nbsp;</font><font color="#CC0000">&nbsp;</font></div></td>
                        <td><input name="group1" type="text" value="<?php echo "$group1"; ?>" /></td>
                      </tr>
                      <tr>
                        <td><div align="right"><font size="-1">Student Group 2:&nbsp;&nbsp;</font><font color="#CC0000">&nbsp;</font></div></td>
                        <td><input name="group2" type="text" value="<?php echo "$group2"; ?>" /></td>
                      </tr>
                      <tr>
                        <td><div align="right"><font size="-1">Student Group 3:&nbsp;&nbsp;</font><font color="#CC0000">&nbsp;</font></div></td>
                        <td><input name="group3" type="text" value="<?php echo "$group3"; ?>" /></td>
                      </tr>
                      <tr>
                        <td><div align="right"><font size="-1">Student Group 4:&nbsp;&nbsp;</font><font color="#CC0000">&nbsp;</font></div></td>
                        <td><input name="group4" type="text" value="<?php echo "$group4"; ?>" /></td>
                      </tr>                      
                      <tr>
                        <td><div align="right"><font size="-1">Student Group 5:&nbsp;&nbsp;</font><font color="#CC0000">&nbsp;</font></div></td>                        
                        <td><input name="group5" type="text" value="<?php echo "$group5"; ?>" /></td>                        
                      </tr>                      
                      <tr>
                        <td><div align="right"><font size="-1">Student Group 6:&nbsp;&nbsp;</font><font color="#CC0000">&nbsp;</font></div></td>                        
                        <td><input name="group6" type="text" value="<?php echo "$group6"; ?>" /></td>                        
                      </tr> 
<tr>
                        <td><div align="right"></div></td>
                        <td><input type="submit" name="Submit" value="Submit Form" /></td>
                      </tr>
                    </form>

You'd do exactly the same as you would for a normal field. Create the necessary fields using

<input type="hidden" value="groupX" name="groupX">

Then on adminlogin.php get the value of the hidden field:

$hidden_field = $_POST['groupX'];
//Then insert into the database along with the text field as necessary

You'd do exactly the same as you would for a normal field. Create the necessary fields using

<input type="hidden" value="groupX" name="groupX">

Then on adminlogin.php get the value of the hidden field:

$hidden_field = $_POST['groupX'];
//Then insert into the database along with the text field as necessary

You've saved me again! Thanks.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.