I appreciate your reply.
I tried your metnod, it still didn't work. It captures the hidden value of stage==1 but not stage==2. Even though it shows "Article has been updated", the article in the database is still the same.
Initially I wanted to pass the hidden value of stage==2 to the next page. But it seems like the value didn't managed to pass through. Is there any way to solve it?
Thanks
Below is are my codes(full):
body_update.php
<? require('e:\inetpub\ftproot\Dumexadmin\wwwroot\revamproot\include\common.php');
function replaceQuote($text)
{
$text=str_replace("\'", "'", $text);
$text=str_replace("'", "'", $text);
$text=str_replace('\"',""",$text);
$text=str_replace('"',""",$text);
return $text;
}
db_connect($conn);
$summary = trim(replaceQuote($summary));
$body = trim(replaceQuote($body));
$datesubmitted = date("m-d-Y H:i:s");
if(!IsSet($stage)) {
?>
<html>
<head>
<title>YoungNutrition.net</title>
<script language="JavaScript">
function confirmSubmit(){
if (confirm("Are you sure you want to submit?"))
return true;
else
return false;
}
</script>
<script src="login_update.js"></script>
<script language="JavaScript">
checkCookie();
</script>
</head>
<body bgcolor="#FDEBEC" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table border="0" cellspacing="0" cellpadding="10" align=center valign=middle width=100% height=100%>
<tr>
<td>
<table border="0" cellspacing="0" cellpadding="0" bgcolor=#FFFFFF width=590 align=center>
<tr>
<td valign="top" align="center">
<table width="93%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td valign="top">
<div class="hometext">
<p align="left">Fill in the article ID and the body text for Health News section: <br>
<table width="100%" border=1 cellspacing=0 cellpadding=3 bordercolor="#F0EBEC">
<form method="post" name="form1" action="<?php print ("$PHP_SELF");?>" onSubmit="return confirmSubmit();">
<TR>
<TD valign=top align=left bgcolor="#FDEBEC"><b>Article
ID: </b></TD>
</TR>
<TR>
<TD valign=top align=left>
<input type="text" name="art_id">
<input type="hidden" name="stage" value="1">
<input name="submit" type="submit" id="submit_id" value="Submit">
</TD>
</TR></form>
<? } else if ($stage == 1)
{$query = "Select summary,body from healthnews where art_id = '$art_id'";
$rsc = odbc_exec($conn, $query);
$summary = odbc_result($rsc,"summary");
$body = odbc_result($rsc,"body");
?>
<form name="form2" method="post" action="body_update.php">
<TR> <TD valign=top align=left bgcolor="#FDEBEC">
<p align="center"><strong>Article ID: <? echo $art_id?></strong><br><br>
<strong>Summary:</strong></p></TD>
</TR>
<TR>
<TD valign=top align=center>
<p align="center">
<textarea name="summary" cols="80" rows="5" id="summary"><? echo $summary?></textarea>
</p>
</TD>
</TR>
<TR>
<TD valign=top align=center bgcolor="#FDEBEC"><b><p align="center">Body:</p></b></TD>
</TR>
<TR>
<TD valign=top align=left>
<p align="center">
<textarea name="body" cols="80" rows="30" id="textarea"><? echo $body ?></textarea>
</p>
<p align="center">
<input type="hidden" name="stage" value="2">
<input type="submit" name="Submit" value="Submit">
</p> </TD> </TR><br></form>
</table>
</div>
</div>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td valign=top> </td>
</tr>
</table>
</td>
</tr>
</table><? } ?>
</body>
</html>
Here's the next page; body_update_submit.php
<?
require('e:\inetpub\ftproot\Dumexadmin\wwwroot\revamproot\include\common.php');
function replaceQuote($text)
{
$text=str_replace("\'", "'", $text);
$text=str_replace("'", "'", $text);
$text=str_replace('\"',""",$text);
$text=str_replace('"',""",$text);
return $text;
}
db_connect($conn);
$summary = trim(replaceQuote($summary));
$body = trim(replaceQuote($body));
if(IsSet($stage==2)) {
$sqls = "update healthnews set summary='$summary', body='$body' where art_id='$art_id'";
$result = odbc_exec($conn,$sqls);
?>
<html>
<head>
<title>YoungNutrition.net</title>
<script language="JavaScript" src="/include/global.js"></script>
</head>
<body bgcolor="#FDEBEC" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table border="0" cellspacing="0" cellpadding="10" align=center valign=middle width=100% height=100%>
<tr>
<td>
<table border="0" cellspacing="0" cellpadding="0" bgcolor=#FFFFFF width=590 align=center>
<tr>
<td rowspan="9" valign=top bgcolor=#FA3E40><img src="/corporate/images/1pixel.gif" width="1" height="1"></td>
<td bgcolor=#EA3E40><img src="/corporate/images/1pixel.gif" width="1" height="1"></td>
<td rowspan="9" valign=top bgcolor=#EA3E40><img src="/corporate/images/1pixel.gif" width="1" height="1"></td>
</tr>
<tr>
<td valign="top" align="center">
<table width="93%" border="0" cellspacing="0" cellpadding="0">
<tr><td valign="top"><div class="hometext"><p align="left"><br>
<form method="post" action="body_update.php"> Would you like to make more updates?
<input type="text" name="art_id">
<input type="hidden" name="stage" value="1">
<input name="submit_more" type="submit" id="submit_more">
</form>
<? if ($result == 0)
print ("Data is not inserted.");
else
print ("Article has been updated.");
?>
<p align="left">Date Submitted <?=$datesubmitted = date("m-d-Y H:i:s")?>
</div>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td valign=top><form action="" name="frmLogoff">
<input type="button" name="btLogoff" value="log out" onclick="logout();">
</form></td>
</tr>
</table>
</td>
</tr>
</table><? } ?>
</body>
</html>
😕 lsh