Jump to content

Getting Back To A Page From .php File


creacon

Recommended Posts

I've been a programmer for 50 years, but am new to web programming (yeah, I'm a dinosaur), but I'm trying to get into the 21st century. I'd certainly appreciate any help with this problem.I'm trying to design an employment questionnaire that consists of a set of pages of questions, with the first page being a form for the entry of the applicant's personal information. Upon "submit"ing, the form posts the data and calls a.php file to process it (i.e. insert records into a mySQL database). This part works fine, and the .php code is executed correctly. The problem is that then I need to send part of the data (the applicant's name) to a field at the top of the next page of the questionnaire and invoke that page, but I can't figure out how to do that. Once the .php file is invoked no further action takes place; I get the "echo" response that I included for testing purposes (ie to prove that the code was executed), but that's as far as the thing goes.I've researched till I'm blue in the face (several books and w3cschools' website) but nowhere have I found an answer. SURELY this must be possible somehow! The books and website tell me very clearly how to invoke the .php code, but fall short of explaining how to get back from it.

Link to comment
Share on other sites

You can also have the page that processes the first form display the second.
That's precisely what I've been trying to do, but can't find out how. When the .php program is called by the first form, it executes and then just sets there waiting and doing NOTHING. Your suggestion to use session data will do the trick for passing the information from one form to the next, but how do I GET TO the next form from the .php program (which displays as a blank form)?All the .php program does is store the information entered in the first form into a mySQL table - at least it will as soon as I learn about that. For now it just emails the info to me just to prove that it's executing.What I'm trying to make it do is to just do its thing and invoke the second form, which would be the first page of a tax credit questionnaire; in fact, I'd prefer if it NEVER became visible at all. The responses from the rest of the questionnaire - which will be several pages, will be stored in the same mySQL table as above, for subsequent access/evaluation for certain tax credit eligibilities.
Link to comment
Share on other sites

If you want to redirect from a PHP script, you can either echo a meta redirect: echo '<META http-equiv="refresh" content="5;URL=go-here.php">'or send a header:header("Location: go-here.php");

Link to comment
Share on other sites

When the .php program is called by the first form, it executes and then just sets there waiting and doing NOTHING.
It's only going to do what you tell it to do - if you tell it to redirect, it will redirect. If you tell it to output a bunch of HTML for the next form, that's what it will do. If you don't tell it to do anything, it's not going to do anything. If you're telling it to do something that it's not doing it's probably hitting a fatal error at some point without showing the error message. In most of those cases it will write the error to a log, you may be able to connect through FTP and look for a file named error_log with PHP errors in it. You can add this code to the top of your script to display all errors in the browser:error_reporting(E_ALL);ini_set('html_errors', 1);ini_set('log_errors', 0);ini_set('display_errors', 1);or you can add this to write all errors to a file called error.log in the same directory as the script:error_reporting(E_ALL);ini_set('error_log', dirname(__FILE__) . DIRECTORY_SEPARATOR . 'error.log');ini_set('html_errors', 0);ini_set('log_errors', 1);ini_set('display_errors', 0);
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...