Forum Moderators: coopster

Message Too Old, No Replies

How to hide a text field in a form?

How to hide a text field in a form

         

emptiness

12:27 am on Jun 18, 2004 (gmt 0)

10+ Year Member



I have two forms in two pages. Field1 is defined in Form1 and inserted in Table1. After submiting the Form1 user goes to Form2. In this form he completes Field2 and Field3. What I wanna do is insert in Table2, the following fields: Field2, Field3 (both defined in Form2) and Field1 (defined in Form1).

$codcliente = $_POST['Field1'];
if ((isset($HTTP_POST_VARS["MM_insert"])) && ($HTTP_POST_VARS["MM_insert"] == "Form2")) {
$insertSQL = sprintf("INSERT INTO Table2 (CodPrograma, CodTipoSuscripcion, CodCliente) VALUES (%s, %s, %s)",

GetSQLValueString(substr($HTTP_POST_VARS['Field2'], 0, 3), "text"),
GetSQLValueString(substr($HTTP_POST_VARS['Field3'], 3), "text"),
$codcliente);

But this doesn't work. So I thought that I can assign the variable value to a new field in the form and then insert it to the Table2 as usually, but I want to hide this field.

The other solution could be to asign the value to a session variable and insert it. But how to insert a session variable in a table?.

Please HELP ME!

thanks a lot

sarahk

2:29 am on Jun 18, 2004 (gmt 0)

10+ Year Member



<input type='hidden' name='fieldname' value='secret'>

will hide the field and add it to the returned values next time.

You just need to name it and give it the right value.

Sarah

emptiness

3:25 pm on Jun 18, 2004 (gmt 0)

10+ Year Member



It worked great! Thanks a lot Sarah!

[edited by: jatar_k at 5:43 pm (utc) on June 18, 2004]
[edit reason] language [/edit]