"Siv Hansen" <si**@broadpark.no> wrote in message
news:43********@news.broadpark.no...
Marcel wrote:
I'm creating an application with which I can update values in a MySQL
database.
Each row of the database table is a web page with a form. After
updating the
fields, the new values are passed on the database table by pressing the
Submit-button. So far, no problems. Then I want to go on to the next
page,
so I was hoping that something like this would work:
echo '<form method="GET" action ="de.php?pageno=5">';
write echo '<form method="get" action="">'
and then change your code in de.php to
if(isset($_REQUEST['page'])){
//connect to your database
//query the database for page where id=the value in $_REQUEST['page']
//retreive html-page and display
}else{
//display normal de.php
}
But it doesn't. I keep on coming back to page 1.
What should I be doing?
Thanks, Marcel
There was a comment on hidden fields. Variables carried by urls are easy
to manipulate,
and although it looks cool (yes it does) perhaps you should avoid them.
Then the method is
post, not get, but the code in de.php remains (since you use the
REQUEST-method which accepts both POST and GET)
Hello again,
I've been trying to implement what was said, but it just doesn't work here..
For the moment I go for the suggestion with a Hidden field in the form,
because that looks the most simple one, and I'm only using this application
at home, it's only for me and not for anybody else..
I'm testing this in IE6 with IIS.
Loading the page goes ok, and the pageno echoes as '1'.
Then I hit submit, the pageno echoes as blank and I get the following
notice: Notice: Undefined index: pageno in
c:\\inetpub\\wwwroot\\picdata\\de2.php on line 39
Here's the code:
<html>
<head>
<title>Picture data entry</title>
</head>
<body>
<div id="container">
<?php
/*initialize pageno */
/* if there is a pageno then it must be one higher then the last time */
if (isset($_GET['pageno']))
{
$pageno = $_GET['pageno'];
$pageno = $pageno++;
}
else
{
$pageno = 1;
}
echo "pageno :" . $pageno;
?>
<p>
<hr align = "left">
<table>
<tr>
<td align = "center" >
<img border = "0" src = "images/01bc11.jpg ">
</td>
<td>
<form method="GET" action ="de2.php?pageno=$pageno">
<input type="text" name="pictureid" value="pictureid" READONLY>
Picture ID <BR>
<input type="text" name="year" value="year" READONLY> Year <BR>
<input type="hidden" name="pageno" value="<?php echo $_GET['pageno'];
?>">
<p>
<input type="submit" name="submit" value="Submit">
</form>
</td>
</tr>
</table>
<hr align = "left">
</div>
</body>
</html>
Thanks for any suggestion...
Marcel