Hello all,
I am working on a script that will modify the records. The first part of script will display me the IDs of records and I will select one ID among them. For this I am using option input type.
Here is my script:
<?php
if ($_POST['verify_epshpm']=="ok") {
echo <<<EOD
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">\n
<head>
<title>Tallentaminen sivu</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body>
<br />
<br />
<br />
<table border="0" cellspacing="0" cellpadding="0" align="center">
<tbody>
<tr>
<td align="right" valign="top" bgcolor="#FFFFFF">
<img src="ktl.gif" alt="" width="286" height="69" /></td>
</tr>
</tbody>
</table>
<table align= "center">
<tbody>
<tr>
<td>
EOD;
$db_username = "student";
$db_password = "itk215";
$db_name = "itk215";
$mysql_link = mysql_connect( "localhost", "$db_username", "$db_password") or die( "Unable to connect to database server");
@mysql_select_db( "$db_name") or die( "Unable to select database");
$result = mysql_query("SELECT record_id,sairaanhoitopiiri,toimipaikkatyyppi,kuntayhtym,mukanahankkeessa,yksikko,paikkakoodi,sokerirasituskokeennytteenottopa,glukoosinmritysmenetelm,yhteyshenkilo,terveyskeskus,tkjatko,katuosoite,postiosoite,puhelin,toinenyhteyshenkilo,note,choice FROM ktl_epshp ORDER BY ktl_epshp.record_id");
$i=0;
while ($array = mysql_fetch_array($result)) {
echo <<<EOD
<table align = "center">
<tbody>
<form action="epshp_update.php" method ="post" />
<input type="hidden" name="verify_epshpmm" value ="ok" />
<tr>
<td>Paikkakoodi:</td>
EOD;
echo "<td>".$array['paikkakoodi']."</td>";
printf ('<td><input type="radio" name "modify" id="del[' . $i . ']" value=' . $array['record_id'] . '></td>');
$i++;
echo <<<EOD
</tr>
</tbody>
</table>
EOD;
}
echo <<<EOD
<td><input type="submit" value="Continue" /></td>
</tr>
</tbody>
</table>
</tr>
</tbody>
</table>
</body>
</html>
EOD;
}
else {
echo "can't access directly";
}
?>
And in the other script which will receive/get the option value.
<?php
if ($_POST['verify_epshpmm']=="ok") {
echo <<<EOD
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">\n
<head>
<title>Tallentaminen sivu</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body>
<br />
<br />
<br />
<table border="0" cellspacing="0" cellpadding="0" align="center">
<tbody>
<tr>
<td align="right" valign="top" bgcolor="#FFFFFF">
<img src="ktl.gif" alt="" width="286" height="69" /></td>
</tr>
</tbody>
</table>
EOD;
$record_ids=$_POST['record_id'];
echo "$record_ids";
echo <<<EOD
</body>
</html>
EOD;
}
else {
echo "can't access directly";
}
?>
I made a quick script just to echo whether I am getting option value or not but I am not 🙁 Can somebody please help me?
And when I will be getting option value, how to select the concern record on the basis of that value from database. Will be the query like:
$result = mysql_query("SELECT record_id,sairaanhoitopiiri,toimipaikkatyyppi,kuntayhtym,mukanahankkeessa,yksikko,paikkakoodi,sokerirasituskokeennytteenottopa,glukoosinmritysmenetelm,yhteyshenkilo,terveyskeskus,tkjatko,katuosoite,postiosoite,puhelin,toinenyhteyshenkilo,note,choice FROM ktl_epshp WHERE ktl_epshp=$record_ids")
Thanks in advance.