Welcome to Dream.In.Code
Getting PHP Help is Easy!

Join 136,004 PHP Programmers for FREE! Get instant access to thousands of PHP experts, tutorials, code snippets, and more! There are 2,365 people online right now. Registration is fast and FREE... Join Now!




If condition is true i have jump another file in php

 
Reply to this topicStart new topic

If condition is true i have jump another file in php

piyu
11 Jan, 2008 - 09:40 PM
Post #1

New D.I.C Head
*

Joined: 11 Jan, 2008
Posts: 2

HI,

I have open or jump to the file which is action file on submit. but If condition is true then file open else massage display "Invalid Login"

I have use following code but i can not open the action file on submit if condition is true.

CODE

<?
$name = $_POST['name'];
$pass = $_POST['password'];
$null="";
        
$que="SELECT password FROM usermast WHERE user_name = '$name'";
$result=mysql_query($que);
$result=mysql_result($result, "password");

$que1="SELECT user_name FROM usermast WHERE user_name = '$name'";

$result1=mysql_query($que1);
result1=mysql_result($result1, "user_name");

if ($_POST['submit'] && $name<>$result1 && $pass<>$result )
{
echo Login Error !!! Please Check User Name and Password ";
}elseif($_POST['submit'] && $name==$null && $pass==$null)
{echo "Login Error !!! Please Enter User Name and Password             
}elseif($_POST['submit'] && $name==$result1 && $pass==$result)
{

!*!*!*! if this condition is true i have jump to action.php !*!*!*!
}
?>

*edit: Please use code tags in the future. Thanks! code.gif

This post has been edited by Martyr2: 11 Jan, 2008 - 09:44 PM
User is offlineProfile CardPM
+Quote Post

Martyr2
RE: If Condition Is True I Have Jump Another File In Php
11 Jan, 2008 - 09:48 PM
Post #2

Programming Theoretician
Group Icon

Joined: 18 Apr, 2007
Posts: 5,184



Thanked: 210 times
Expert In: C/C++, Java, VB, VB.NET, C#, PHP, Web Development, HTML & CSS, Javascript

My Contributions
If this code is at the top of your page and you have not sent any content to screen then you can use the header() function to send the user to the action.php file. You use it like so header("location: action.php");

If you have sent any blank spaces, characters or headers already before reaching this code, it won't work. If it is at the top of your page, then no problems. Just make sure you haven't sent any content to the output buffer.

Hope that helps you. smile.gif
User is online!Profile CardPM
+Quote Post

musya
RE: If Condition Is True I Have Jump Another File In Php
11 Jan, 2008 - 11:00 PM
Post #3

D.I.C Regular
Group Icon

Joined: 25 Apr, 2007
Posts: 291



Thanked: 1 times
Dream Kudos: 50
My Contributions
QUOTE(Martyr2 @ 11 Jan, 2008 - 10:48 PM) *

If this code is at the top of your page and you have not sent any content to screen then you can use the header() function to send the user to the action.php file. You use it like so header("location: action.php");

If you have sent any blank spaces, characters or headers already before reaching this code, it won't work. If it is at the top of your page, then no problems. Just make sure you haven't sent any content to the output buffer.

Hope that helps you. smile.gif


And if he has sent content to the screen how can he do it?
User is offlineProfile CardPM
+Quote Post

piyu
RE: If Condition Is True I Have Jump Another File In Php
11 Jan, 2008 - 11:09 PM
Post #4

New D.I.C Head
*

Joined: 11 Jan, 2008
Posts: 2

QUOTE(Martyr2 @ 11 Jan, 2008 - 10:48 PM) *

If this code is at the top of your page and you have not sent any content to screen then you can use the header() function to send the user to the action.php file. You use it like so header("location: action.php");

If you have sent any blank spaces, characters or headers already before reaching this code, it won't work. If it is at the top of your page, then no problems. Just make sure you haven't sent any content to the output buffer.

Hope that helps you. smile.gif



Sorry ! I can not set action.file on submit when condition is true.
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 12/1/08 12:31PM

Live PHP Help!

PHP Tutorials

Reference Sheets

PHP Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month