Jump to content

Posting Variable in a hidden field.


topshelfbleu

Recommended Posts

I am retrieving a single row from a table and I want to use one of the fields in a post form which will be sent to process.php

I have successfully use echo to place some results where I want them – but I want to use some of the row results as hidden fields.

 

The code I am using to retrieve from the table is

$result = mysql_query("SELECT qid,question,oc1 FROM tblquestions WHERE qid = '1'"); 

 

The oc1 field  is the one I want to post by way of a hidden field so that it can be passed to the process.php.

 

I have tried

[/echo $row[2]; // oc1
$oc1 = $row[2];php]

And then in the form:

[code=php:0]<input type="hidden" name="oc1" id="oc1" value= <?php echo $oc1?> />

 

I think I just read that this can't actually be done- but I'm new to all this, so am not sure whether I've understood how I should be doing it instead.

 

Any help REALLY gratefully received! ;)

 

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/215868-posting-variable-in-a-hidden-field/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.