(Resolved) Returning from PHP

Discussing Html . Code , Software , other

Moderators: macek, egami, gesf

User avatar
jpfred
New php-forum User
New php-forum User
Posts: 4
Joined: Tue Jan 30, 2007 6:23 am
Location: Louisiana
Contact:

(Resolved) Returning from PHP

Postby jpfred » Thu Feb 01, 2007 4:38 am

I have an HTML document that has "<form action="registration.php" method="post">" imbeded so that on a submit button press the registration.php is called.

My question is in two parts.
1. How do I keep the page from displaying since it does nothing but post to a database.
2. How do I return from a PHP page to the original HTML page or a different one.
Last edited by jpfred on Fri Feb 02, 2007 9:45 am, edited 1 time in total.

User avatar
gesf
Moderator
Moderator
Posts: 1717
Joined: Sun Dec 29, 2002 5:03 am
Location: Portugal / Sweden
Contact:

Postby gesf » Fri Feb 02, 2007 5:13 am

I'm not sure if i get the point but, for both question, you can have your form and process script in same file so you'll have the same code from the form file after the submittion.
You can also, after processing, in your registration.php file, add this next code so it will send you to the page you want:

Code: Select all

<?php

header('Location: /url/to/your/page.php');

?>
You can also make this call in the background using xmlhttprequest and nothing will change/move in the form file.
Of course, this all really depends on what you're trying to do.

User avatar
jpfred
New php-forum User
New php-forum User
Posts: 4
Joined: Tue Jan 30, 2007 6:23 am
Location: Louisiana
Contact:

Postby jpfred » Fri Feb 02, 2007 9:47 am

The addition of header('Location: ../index.html'); to my php did exactly what I needed.

Thanks! :D

User avatar
gesf
Moderator
Moderator
Posts: 1717
Joined: Sun Dec 29, 2002 5:03 am
Location: Portugal / Sweden
Contact:

Postby gesf » Wed Feb 07, 2007 11:24 am

Any time :)


Return to “HTML Basics”

Who is online

Users browsing this forum: No registered users and 1 guest