Re: Get variable from PHP before submit

From: Date: Mon, 03 Mar 2003 00:07:15 +0000
Subject: Re: Get variable from PHP before submit
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-137818@lists.php.net to get a copy of this message
I could use anchor's like shown underneath, but then the user will have to click the link "Last position" each time a button is submitted. I would like the page to scroll down automatically. Is that possible, to have the link executed without clicking help from the user? <body onLoad="mScroll()"> <?php echo "<p> Ykoordinat: " . $yKoord . "<p>"; echo "Teller: " . $teller; ?> <a href="#form<?php echo $teller; ?>" target="_self"> Last position </a> <!-- *****New line**** --> <?php for($i=0; $i<150; $i++) { echo '<br>'; } for($teller=0; $teller<2; $teller++) { ?> <a name="form<?php echo $teller; ?>"></a> <!-- *****New line**** --> <form action="test3.php" name="form<?php echo $teller; ?>" onsubmit="return hentKoordinat()"> <input type="hidden" name="teller" value="<?php echo $teller; ?>"> <input type="hidden" name="yKoord"> <input name="button1" type="submit" value="Send input"> </form> <?php $teller++; ?> <?php } //for($teller=0; $i<2; $i++) { ?> </body> "Rich Gray" <rich@f1central.net> skrev i melding news:EDEGIPFFGBJHCIJCMPKOIEIMEBAA.rich@f1central.net... > > I'm trying to implement the following functionality into the file > > test.php: > > > > When I scroll down the page and then hit a button, the page > > should remember > > the scrolled position, refresh the page and then scroll down to the > > remembered position. I've almost managed to make this work, but > > only almost. > > > > The first time I click one of the buttons, the page won't scroll, > > but after > > that it works fine. I think the reason for this is that the function > > hentKoordinat() gets called before $teller is set. hentKoordinat() uses > > $teller. > > > > Anyone know a way to make this work? > > > > Thanks alot! > > > > Lars > > I've probably misunderstood but can you not use an HTML anchor...? > Rich >

« previous php.general (#137818) next »