|
");
// ---------------------------------- Left Banner
require('incs/left_banner.inc');
echo("
|
");
// ---------------------------------- Top Banner
require('incs/header.inc');
echo("
|
|
");
// ---------------------------------- M A I N B O D Y
// Content and forms go here!
// ---------------------------------- P U B L I S H Q U E S T I O N
if ($mode == 'publish')
{
echo("
");
}
// ---------------------------------- S A V E Q U E S T I O N
// Decision on whether to save new
// record or to update an existing
// record.
$code = time();
if ($mode == 'save')
{
require('incs/connect.inc');
$sql="insert into questions
(
q1,
qt1,
a1a,
a1b,
a1c,
a1d,
email,
code,
password,
title,
return_url)
values (
'$q1',
'$qt1',
'$a1a',
'$a1b',
'$a1c',
'$a1d',
'$email',
'$code',
'$password',
'$title',
'$return_url')";
$result = mysql_query($sql);
// -------------------
// Accessing id number
require('incs/connect.inc');
$result = mysql_query("select id
from questions",$db);
while ($myrow = mysql_fetch_row($result))
{
if ($code == $myrow[33])
{
$id = $myrow[0];
}
}
}
if ($mode == 'update')
{
require('incs/connect.inc');
$sql="
update questions
set
q1 = '$q1',
qt1 = '$qt1',
a1a = \"$a1a\",
a1b = \"$a1b\",
a1c = \"$a1c\",
a1d = \"$a1d\",
q2 = '$q2',
qt2 = '$qt2',
a2a = '$a2a',
a2b = '$a2b',
a2c = '$a2c',
a2d = '$a2d',
q3 = '$q3',
qt3 = '$qt3',
a3a = '$a3a',
a3b = '$a3b',
a3c = '$a3c',
a3d = '$a3d',
q4 = '$q4',
qt4 = '$qt4',
a4a = '$a4a',
a4b = '$a4b',
a4c = '$a4c',
a4d = '$a4d',
q5 = '$q5',
qt5 = '$qt5',
a5a = '$a5a',
a5b = '$a5b',
a5c = '$a5c',
a5d = '$a5d',
email = '$email',
title = '$title',
return_url = '$return_url'
where id = $id";
$result = mysql_query($sql);
}
// ---------------------------------- U P D A T E Q U E S T I O N S
// ---------------------------------- A C C E S S I N G D A T A
// Accessing saved data to be filled
// into tool.
if ($id < 1)
{
include ('incs/initial_form.inc');
} else
{
require('incs/connect.inc');
$result = mysql_query("select * from questions where id = $id",$db);
while ($myrow = mysql_fetch_row($result))
{
echo("
");
}
}
?> |
|