PHP
--
Questions
--
Followers
Top Experts
here is my login and password..hp
if (........)
echo "success"'
XXXXXXXXXX
else
echo "wrong password";
basically ,if the user name and password match... Currently i just echo"success"
but what i want is open a new pages called let say main.php ...
Can someone give me illustration about it ?
thanks
Zero AI Policy
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
you use that when you want to redirect
sorry posted when I wasnt finished yet






EARN REWARDS FOR ASKING, ANSWERING, AND MORE.
Earn free swag for participating on the platform.
header('location: http://'.$_SERVER['HTTP_HOST'].dirname($_SE
or make it a function:
function goto($loaction){
header('location: http://'.$_SERVER['HTTP_HOST'].dirname($_SE
}
and call it like this:
goto('nologin.php');
echo"<meta http-equiv=\"refresh\" contents=\"0;URL=URL_OF_PA
or call the other page from the original one using <<include('file.php');>>
can any1 help me

Get a FREE t-shirt when you ask your first question.
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
the header or setcookie functions for example,
you must not output anything beforehand as this will result in terminating the headers and you'll get this message.
have a look in the manual at the function that causes this message, this is a well-documented issue.
the way out is either don't use that function (hence the meta solution, though cross-compatibility means you have to write it twice), or don't output anything before (even a blank line before the original <? will mess it up), or use buffering.
try ob_start in google and pick any online manual for examples and related functions
($redirect == "ok")?header('location:mai
//either you span this
you can also do it with javascript echo "<script>document.location
you use that when you want to redirect main.php after no logon availables






EARN REWARDS FOR ASKING, ANSWERING, AND MORE.
Earn free swag for participating on the platform.
The problem is when the new window opens it echos all of the "...you forgot to(s) rather than just what you forgot to input, name, address etc.
Any clues?
Do I need to unload a buffer or memory or something for this new window page??
Thanks.
you probably used something like
foreach($_POST as $var => $val){ // or $_GET or whatever
if(!$val)print ('...');
... }
any string will trigger the error since a string is evalued to numeric 0 alias false usually
the 'good' comparison should be similar to :
if(trim($val)=="")echo 'you must specify a valid input for $var'.
anyway, if the check is not that more thoroughfull, it is rather useless.
let us see what the code is like !
http://www.netbulge.com/index.php?session=0&action=read&click=open&article=1113900339

Get a FREE t-shirt when you ask your first question.
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
There is a work-around for this problem, and even though I don't support this solution, I'll still mention it.
Use the output-buffer-function:
<?php
ob_start();
// script with screen output
ob_end();
?>
The output-buffer will store the info, and it will work like a charm.
With that said, I still support the idea of coding properly.
I was not aware of that function. Yes, it certainly is not a very good coding practice, but it can get you out of trouble in cases like this.
Thanks for posting that.






EARN REWARDS FOR ASKING, ANSWERING, AND MORE.
Earn free swag for participating on the platform.
PHP
--
Questions
--
Followers
Top Experts
PHP is a widely-used server-side scripting language especially suited for web development, powering tens of millions of sites from Facebook to personal WordPress blogs. PHP is often paired with the MySQL relational database, but includes support for most other mainstream databases. By utilizing different Server APIs, PHP can work on many different web servers as a server-side scripting language.