Jump to content

Inserting specific mysql records into a php post form


topshelfbleu

Recommended Posts

I want to pull some records  plus unique key from one mysql table and then use them as questions in a form/questionnaire.

 

The post form will have six radio buttons  to the right of the fields pulled with the key posted but hidden and will wirte to another table.

 

I guess this is a templating question- as I've successfully retrieved the table 1 records via a query - I just can't seem to use them in the form. Below is the code I'm using to view table "PCM1"

 

<?php // query.php
require_once 'login.php';
$db_server = mysql_connect($db_hostname, $db_username, $db_password);

if (!$db_server) die("Unable to connect to MySQL: " . mysql_error());

mysql_select_db($db_database)
or die("Unable to select database: " . mysql_error());

$query = "SELECT * FROM pcm1";
$result = mysql_query($query);

if (!$result) die ("Database access failed: " . mysql_error());

$rows = mysql_num_rows($result);

for ($j = 0 ; $j < $rows ; ++$j)
{
echo 'RID: '   . mysql_result($result,$j,'mcde')  ;
echo 'Statement: '    . mysql_result($result,$j,'oppclub')    . '<br />';

;
}

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.