Page Control

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
OldManRiver
Forum Newbie
Posts: 7
Joined: Mon Jul 17, 2006 3:56 pm
Contact:

Page Control

Post by OldManRiver »

All,

Trying to read through all the manual to determine how control is returned to the calling page for the following scenario:

Code: Select all

<form method=post action=myproc.php>
without using the

Code: Select all

header(Location:mypage.php)
in the myproc.php file.

OMR
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Since I don't really see a question, I'll assume it's "how do I do ...?"

In which case, myproc.php would output the form again. I'll guess that the form is not in myproc.php, so you may be able to use file_get_contents(), or possibly include().
OldManRiver
Forum Newbie
Posts: 7
Joined: Mon Jul 17, 2006 3:56 pm
Contact:

Post by OldManRiver »

All,

Actually the form is in the mypage.php file and I have
used both the require statment and the action in the form to call the
myproc.php file.

What the problem is, I can not get the vars to return, regardless of whether I use
the global statement for the vars I need to see or not.

It is a simple login process and I need to show the fields and login on first pass
and the results from the DB query (Welcome vs. Failed) on second pass.

Can't get the passes or var exchange to work correctly!

Do not want to use $_PHP_SELF for security reasons, unless you can show me
a good way to secure it.

OMR
User avatar
a94060
Forum Regular
Posts: 543
Joined: Fri Feb 10, 2006 4:53 pm

Post by a94060 »

you can always put the validation on another page,so that you can bypass you "security reasons" and then get it over there by using the $_POST['var'] array.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

The general way to refill the form with the submitted content is roughly:

Code: Select all

echo '<input type="text" value="' . $value . '" />';
or something similar.
OldManRiver
Forum Newbie
Posts: 7
Joined: Mon Jul 17, 2006 3:56 pm
Contact:

What I have

Post by OldManRiver »

What I have is:

First Pass:

Code: Select all

$display_block = "<form action='../scripts/login.php' method='POST'><p><strong>User Login:</strong><br>
             				 <INPUT TYPE='text' NAME='username'></p><p><strong>Password:</strong><br>
             				 <INPUT TYPE='password' NAME='password'></p><p>&nbsp;<br>
            				 <input type=image src='../Images/btn-pale(log).jpg' name=log value=log width=120>
	            			 </form>";
Second Pass with Success:

Code: Select all

$display_block = "<font size=-1><b>Welcome $f_name $l_name.
                                <br>Thank you for logging in!</b></font>";
Second Pass with Failure:

Code: Select all

$display_block = "<font size=-1><b>Login not successful!</b></font>";
The $display_block sets on first pass, but does not set on second. When I use header it sees the runs as first pass and resets everything, so can not get the transfer.

Should be simple, but it isn't.

OMR
Post Reply