473,396 Members | 1,892 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Jump to section of same page

TG
Dear PHP Group,

How can I in PHP, based on a result, move the cursor to a certain location
on the page? I want the same result as Anchor tags in HTML. I want to go to
a certain section of the same page based on a return result in PHP. What
this is for is an order forms page - when a user fills out a section
incorrectly, I want the page to display at that location in the form after
the user presses a submit button.

How do I do this?

Thanks,
Jul 17 '05 #1
5 7826
TG schrieb:
How can I in PHP, based on a result, move the cursor to a certain location
on the page?
You can't. PHP is running on the server and when the browser displays
your page, the PHP script is long gone.
I want the same result as Anchor tags in HTML. I want to go to
a certain section of the same page based on a return result in PHP. What
this is for is an order forms page - when a user fills out a section
incorrectly, I want the page to display at that location in the form after
the user presses a submit button.


Then use HTML anchors.

Regards,
Matthias
Jul 17 '05 #2
TG
Matthias,

In this particular case a submit button is pressed the page is
self-referential so the check can occur afterwards and perform an action on
the same page (for example I have PHP code to check a users input on an
order form -- based on a PHP check I can run this check and have a result
occur on this same page). An HTML anchor must be pressed to navigate to a
page location I believe, unless you know a way to force it to occur without
user input.
"Matthias Esken" <mu******************@usenetverwaltung.org> wrote in
message news:cb**********@usenet.esken.de...
TG schrieb:
How can I in PHP, based on a result, move the cursor to a certain location on the page?


You can't. PHP is running on the server and when the browser displays
your page, the PHP script is long gone.
I want the same result as Anchor tags in HTML. I want to go to
a certain section of the same page based on a return result in PHP. What
this is for is an order forms page - when a user fills out a section
incorrectly, I want the page to display at that location in the form after the user presses a submit button.


Then use HTML anchors.

Regards,
Matthias

Jul 17 '05 #3
TG schrieb:
In this particular case a submit button is pressed the page is
self-referential so the check can occur afterwards and perform an action on
the same page (for example I have PHP code to check a users input on an
order form -- based on a PHP check I can run this check and have a result
occur on this same page). An HTML anchor must be pressed to navigate to a
page location I believe, unless you know a way to force it to occur without
user input.


OK, I see the problem.

You could use header() to make a second redirection to the same page
after the check shows an error. In this redirection you would add the
anchor.

The drawback is, that you have to transport the data from the first to
the second call and you have to perform the check twice. Maybe there's a
solution with JavaScript - for those browsers which have JavaScript
enabled.

Matthias
Jul 17 '05 #4
TG
Thanks, I'll try that.

"Matthias Esken" <mu******************@usenetverwaltung.org> wrote in
message news:cb**********@usenet.esken.de...
TG schrieb:
In this particular case a submit button is pressed the page is
self-referential so the check can occur afterwards and perform an action on the same page (for example I have PHP code to check a users input on an
order form -- based on a PHP check I can run this check and have a result occur on this same page). An HTML anchor must be pressed to navigate to a page location I believe, unless you know a way to force it to occur without user input.


OK, I see the problem.

You could use header() to make a second redirection to the same page
after the check shows an error. In this redirection you would add the
anchor.

The drawback is, that you have to transport the data from the first to
the second call and you have to perform the check twice. Maybe there's a
solution with JavaScript - for those browsers which have JavaScript
enabled.

Matthias

Jul 17 '05 #5
"TG" <tg********@cox.net> wrote in message
news:Mm1Bc.10138$cj3.8582@lakeread01...
Dear PHP Group,

How can I in PHP, based on a result, move the cursor to a certain location
on the page? I want the same result as Anchor tags in HTML. I want to go to a certain section of the same page based on a return result in PHP. What
this is for is an order forms page - when a user fills out a section
incorrectly, I want the page to display at that location in the form after
the user presses a submit button.

How do I do this?


Since it's not a critical function, I would just use Javascript to set the
focus on the input field. Something like this at the end of the script would
work:

echo "<script> document.getElementById('phone').setFocus(); </script>";
Jul 17 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Margaret MacDonald | last post by:
I'm seeing a problem that has me flummoxed. The only thing I can think of is that I'm violating some rule I don't know about. I have some code that does some processing and then does a...
4
by: Sleepless on the Web | last post by:
Is there a limit to how many items can be in a jump list? My script worked fine with 126 items, but at 152 items it just doesn't work. When I select a page from the drop down menu it will only...
3
by: Robert Mark Bram | last post by:
Hi All! Let's say I have a form like this: <form action="handler.asp"> ... </form> Within handler.asp, I output a number of named anchors: <a name="important1">Important 1</a> ... <a...
2
by: VB Programmer | last post by:
I created a page which I am using to prevent the user from hitting the BACK button. I'll call it my "Auto Jump" page. When it is called it basically auto-redirects to a page specified in the...
6
by: Tabi | last post by:
Hi, I want to create a custom section in my web.config that can hold my custom values. I created a section in web.config as written below. <configSections> <section name="myCustomSection"...
4
by: robert d via AccessMonster.com | last post by:
When my app starts up, it creates a temporary database. This temp database is created from a 'model' database that is in the same folder as the application. Because there is a model, the creation...
2
by: Eadwine Rose | last post by:
I have this little bitty script on my site that makes a jump to the top of the screen when one double left clicks anywhere in the page. I was wondering if it could be altered so the double left...
0
by: peter.c.bradley | last post by:
Hi folks, I have an Access report that has an unbound text box in the details section. The report also includes the standard headers and footers. The details section is populated by a query...
3
by: dragon52 | last post by:
Hi, When the user click a button on screen I display a table of info way down the page and I like to immediately jump to that section of the page, ie without the user having to scroll down to see...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.