Re: [PHP-DB] Redirect upon successful form submission

2009-12-15 Thread Bastien Koert
On Tue, Dec 15, 2009 at 12:48 PM, Vinay Kannan viny...@gmail.com wrote:
 Hi,

 I have 2 pages on php, the first page has a small form to accept a
 membership number from the user, which checks for membership number in the
 DB, if the membership no does not exist, gives an error saying 'you are not
 a member click here to become a member now', this bit works fine.

 The problem is the following bit 'if the user is a member, i want the user
 to be directed to another page.

 this is what i did to get the result since header(Location:) wont
 work, as already the form has been printed on the page.

 echo'META HTTP-EQUIV=refresh content=0;URL=member.php'; but the
 problem is that this takes couple of seconds, till then the page is very
 much visible which doesnt look good.

 Any help on this is much appreciated.

 Thanks,
 Vinay.


What about holding the form in the buffer, and then dealing with the
buffer before sending the form?


-- 

Bastien

Cat, the other other white meat

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Redirect upon successful form submission

2009-12-15 Thread Vinay Kannan
Thanks Bastien,

To be honest I have no clue as to how to hold the form in the buffer. I've
copied the code below, that might help I guess.


?php include(header.php);
include(lib/funcs.php);
$url=$_SERVER['REQUEST_URI'];
$member_no=$_POST['member_no'];
$member_no=trim(htmlspecialchars($member_no));
$not_member=1;
if(isset($_POST['submit'])  $_POST['trigger']==6)
{
//  echo $member_no;
  $conn=mysql_connect($host,$user,$pass) or die(Could not open the
connection);
  $dbselect=mysql_select_db($dbname,$conn) or die(could not connect to the
DB);
  $id_query=SELECT * FROM members WHERE member_id='$member_no';
  $result = mysql_query($id_query) or trigger_error(SQL, E_USER_ERROR);
  $num_rows=mysql_num_rows($result);
  //echo $num_rows;
  if($num_rows0)
  {
echo'META HTTP-EQUIV=refresh content=0;URL=member.php';

  }

  else
  {

 $not_member=0;
   }


}
 ?
td width=420 class=whitebg
BR /
h3 align=leftREFERENCE FOR MEMBERSHIP TO INFINITY LEARNERS CLUB/h3
p
In order to be able to refer members to Infinity LMRC, you need to be a
registered member with us, Please enter your membership number below and
start referring./p
table width=410
form action=?php echo $url ; ? method=post name=refer 
table
tr
tdlabel for=membernoMembership Number/label/td
tdinput type=text name=member_no class=myinput //td/tr
trtdnbsp;/td/tr
trtdinput type=submit name=submit value= OK ! //td
tdinput type=reset name=cancel value= Cancel  //td/tr
trtdinput type=hidden name=trigger value=6 //td/tr
/table
/form
?php
if($not_member==0)
{
  echo 'Our records indicate that you are not a member yet, a
href=member.php Click here/a to become a member now';
  }?
/td
?php include(footer.php);?
/body
/html


On Tue, Dec 15, 2009 at 10:09 AM, Bastien Koert phps...@gmail.com wrote:

  On Tue, Dec 15, 2009 at 12:48 PM, Vinay Kannan viny...@gmail.com wrote:
  Hi,
 
  I have 2 pages on php, the first page has a small form to accept a
  membership number from the user, which checks for membership number in
 the
  DB, if the membership no does not exist, gives an error saying 'you are
 not
  a member click here to become a member now', this bit works fine.
 
  The problem is the following bit 'if the user is a member, i want the
 user
  to be directed to another page.
 
  this is what i did to get the result since header(Location:) wont
  work, as already the form has been printed on the page.
 
  echo'META HTTP-EQUIV=refresh content=0;URL=member.php'; but the
  problem is that this takes couple of seconds, till then the page is very
  much visible which doesnt look good.
 
  Any help on this is much appreciated.
 
  Thanks,
  Vinay.
 

 What about holding the form in the buffer, and then dealing with the
 buffer before sending the form?


 --

 Bastien

 Cat, the other other white meat



Re: [PHP-DB] Redirect upon successful form submission

2009-12-15 Thread Christoph Rosse
you could also validate the form in a seperate php file with no output 
and then redirect to the error and the another page ?



Bastien Koert schrieb:

On Tue, Dec 15, 2009 at 12:48 PM, Vinay Kannan viny...@gmail.com wrote:
  

Hi,

I have 2 pages on php, the first page has a small form to accept a
membership number from the user, which checks for membership number in the
DB, if the membership no does not exist, gives an error saying 'you are not
a member click here to become a member now', this bit works fine.

The problem is the following bit 'if the user is a member, i want the user
to be directed to another page.

this is what i did to get the result since header(Location:) wont
work, as already the form has been printed on the page.

echo'META HTTP-EQUIV=refresh content=0;URL=member.php'; but the
problem is that this takes couple of seconds, till then the page is very
much visible which doesnt look good.

Any help on this is much appreciated.

Thanks,
Vinay.




What about holding the form in the buffer, and then dealing with the
buffer before sending the form?


  



--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Redirect upon successful form submission

2009-12-15 Thread Vinay Kannan
Yep, that would work, but then if the user is not a member, then the link to
the membership should be printed on the form that has the validation and not
the one that has the form?

On Tue, Dec 15, 2009 at 10:21 AM, Christoph Rosse c...@okto.tv wrote:

 you could also validate the form in a seperate php file with no output and
 then redirect to the error and the another page ?


 Bastien Koert schrieb:

 On Tue, Dec 15, 2009 at 12:48 PM, Vinay Kannan viny...@gmail.com wrote:


 Hi,

 I have 2 pages on php, the first page has a small form to accept a
 membership number from the user, which checks for membership number in
 the
 DB, if the membership no does not exist, gives an error saying 'you are
 not
 a member click here to become a member now', this bit works fine.

 The problem is the following bit 'if the user is a member, i want the
 user
 to be directed to another page.

 this is what i did to get the result since header(Location:) wont
 work, as already the form has been printed on the page.

 echo'META HTTP-EQUIV=refresh content=0;URL=member.php'; but the
 problem is that this takes couple of seconds, till then the page is very
 much visible which doesnt look good.

 Any help on this is much appreciated.

 Thanks,
 Vinay.




 What about holding the form in the buffer, and then dealing with the
 buffer before sending the form?






 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] Redirect upon successful form submission

2009-12-15 Thread Bastien Koert
On Tue, Dec 15, 2009 at 1:25 PM, Vinay Kannan viny...@gmail.com wrote:
 Yep, that would work, but then if the user is not a member, then the link to
 the membership should be printed on the form that has the validation and not
 the one that has the form?

 On Tue, Dec 15, 2009 at 10:21 AM, Christoph Rosse c...@okto.tv wrote:

 you could also validate the form in a seperate php file with no output and
 then redirect to the error and the another page ?


 Bastien Koert schrieb:

 On Tue, Dec 15, 2009 at 12:48 PM, Vinay Kannan viny...@gmail.com wrote:


 Hi,

 I have 2 pages on php, the first page has a small form to accept a
 membership number from the user, which checks for membership number in
 the
 DB, if the membership no does not exist, gives an error saying 'you are
 not
 a member click here to become a member now', this bit works fine.

 The problem is the following bit 'if the user is a member, i want the
 user
 to be directed to another page.

 this is what i did to get the result since header(Location:) wont
 work, as already the form has been printed on the page.

 echo'META HTTP-EQUIV=refresh content=0;URL=member.php'; but the
 problem is that this takes couple of seconds, till then the page is very
 much visible which doesnt look good.

 Any help on this is much appreciated.

 Thanks,
 Vinay.



 What about holding the form in the buffer, and then dealing with the
 buffer before sending the form?





 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




When you look at it like that all together, I find its easier to
functionalize the whole process

?php

include(header.php);
include(lib/funcs.php);


if(isset($_POST['submit'])){
  processForm();
}else{
  showForm();
}

function processForm(){

$url=$_SERVER['REQUEST_URI'];
$member_no=$_POST['member_no'];
$member_no=trim(htmlspecialchars($member_no));
$not_member=1;
if(isset($_POST['submit'])  $_POST['trigger']==6)
{
//  echo $member_no;
  $conn = mysql_connect($host,$user,$pass) or die(Could not
open the connection);
  $dbselect = mysql_select_db($dbname,$conn) or die(could not
connect to the DB);
  $id_query = SELECT * FROM members WHERE 
member_id='$member_no';
  $result   = mysql_query($id_query) or trigger_error(SQL, 
E_USER_ERROR);
  $num_rows = mysql_num_rows($result);
  //echo $num_rows;
  if($num_rows0)   
  {
echo'META HTTP-EQUIV=refresh 
content=0;URL=member.php';

  } 
  else
  { 

if($not_member==0)
{
  echo 'Our records indicate 
that you are not a member yet, a
href=member.php Click here/a to become a member now';
}

  }

}//end function processForm

function showForm(){
?
td width=420 class=whitebg
BR /
h3 align=leftREFERENCE FOR MEMBERSHIP TO INFINITY LEARNERS 
CLUB/h3
p
In order to be able to refer members to Infinity LMRC, you need 
to
be a registered member with us, Please enter your membership number
below and start referring./p
table width=410
form action=?php echo $url ; ? method=post name=refer 
table
tr
tdlabel for=membernoMembership Number/label/td
tdinput type=text name=member_no class=myinput 
//td/tr
trtdnbsp;/td/tr
trtdinput type=submit name=submit value= OK ! //td
tdinput type=reset name=cancel value= Cancel  
//td/tr
trtdinput type=hidden name=trigger value=6 
//td/tr
/td
?php include(footer.php);?
/table
/form
/body
/html


?php
}//end showForm function
?


This gives way more control over the whole flow

-- 

Bastien

Cat, the other other white meat

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Redirect.

2003-12-02 Thread Richard Davey
Hello gfmb,

Tuesday, December 2, 2003, 11:18:40 AM, you wrote:

gli I have a problem.How can I redirect from a PHP script to
gli another script in asp, php or a HTML page? 
gli This script redirect to another script in function of the values of a variable.

This isn't really a database related question, is it?
See PHP-General.

-- 
Best regards,
 Richardmailto:[EMAIL PROTECTED]

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Redirect.

2003-12-02 Thread Ignatius Reilly
header( Location: http://...; ) ;

_
- Original Message -
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, December 02, 2003 12:18
Subject: [PHP-DB] Redirect.


Hi all,
I have a problem.How can I redirect from a PHP script to another script in
asp, php or a HTML page?
This script redirect to another script in function of the values of a
variable.
Thanks in advance
Francesco
[EMAIL PROTECTED]

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP-DB] Redirect.

2003-12-02 Thread Hutchins, Richard
Don't know if I fully understand your question, but, in general, you can
handle redirects with the header() function, e.g., 

header(Location:
http://www.yoursite.com/yourscript.php?msg=0storyID=.$newstory.;);

As you can see, you can include variable=value pairs at the end of the URL
as well (msg and storyID in the example above).

Check for the header() function in the documentation on php.net for
additional information. PHP-GENERAL, as suggested by another user, is the
most appropriate and possibly more helpful mailing list for your particular
question.

HTH,
Rich

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, December 02, 2003 6:19 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] Redirect.
 Importance: High
 
 
 Hi all,
 I have a problem.How can I redirect from a PHP script to 
 another script in asp, php or a HTML page? 
 This script redirect to another script in function of the 
 values of a variable.
 Thanks in advance
 Francesco
 [EMAIL PROTECTED]
 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] redirect

2003-10-27 Thread Rolf Brusletto
Dan Liu wrote:

Hi all,
Has anyone used 'Module mod_rewrite URL Rewriting Engine'? 
I need to do a redirect from
http://url1/cgi-bin/mapserv?map=/dir1/county.map
to 
http://url2/cgi-bin/mapserv?map=/dir2/county.map

But it is not working. Does somebody know why?
Thanks in Advance.
Dan
 

Dan - without seeing the rewrite code.. its sorta hard to tell why it 
wouldn't be working!!!

simply put, if your host allows you to use a .htaccess and mod_rewrite.. 
in the .htaccess

RewriteEngine On
RewriteRule /usage.html /usage/index.html
Where /usage.html is the file that was requested, and /usage/index.html 
is the file that it needs to go to.

Rolf Brusletto
www.phpExamples.net
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DB] redirect

2003-10-27 Thread Peter Beckman
Wrong list to ask on -- you are looking for an Apache mailing list.

http://apache.org/  read the manual page on mod_rewrite

On Mon, 27 Oct 2003, Dan Liu wrote:

 Hi all,
 Has anyone used 'Module mod_rewrite URL Rewriting Engine'?
 I need to do a redirect from
 http://url1/cgi-bin/mapserv?map=/dir1/county.map
 to
 http://url2/cgi-bin/mapserv?map=/dir2/county.map

 But it is not working. Does somebody know why?
 Thanks in Advance.
 Dan


 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php



---
Peter Beckman  Internet Guy
[EMAIL PROTECTED] http://www.purplecow.com/
---

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP-DB] redirect

2003-03-01 Thread Jeremi Bergman
Nevermind, I found the answer, and why it wasn't working.  Now I was
wondering how I can format a number to be a currency?  Like if
$totalprice = 14.343 have it print 14.34.

thanks

-Original Message-
From: Jeremi Bergman [mailto:[EMAIL PROTECTED] 
Sent: Saturday, March 01, 2003 2:13 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] redirect

How can I redirect a user to a specific page if they are already
authenticated?

if ($SESSION_Authenticated) { //code here to redirect; }

thanks



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php





-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP-DB] redirect

2003-03-01 Thread John W. Holmes
 Nevermind, I found the answer, and why it wasn't working.  Now I was
 wondering how I can format a number to be a currency?  Like if
 $totalprice = 14.343 have it print 14.34.

Number_format() or printf()

---John W. Holmes...

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP-DB] redirect

2003-03-01 Thread Kurth Bemis (List Monkey)
At 04:33 PM 3/1/2003 -0500, Jeremi Bergman wrote:

www.php.net/round

find the answer there, you will :-)

~kurth

Nevermind, I found the answer, and why it wasn't working.  Now I was
wondering how I can format a number to be a currency?  Like if
$totalprice = 14.343 have it print 14.34.
thanks

-Original Message-
From: Jeremi Bergman [mailto:[EMAIL PROTECTED]
Sent: Saturday, March 01, 2003 2:13 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] redirect
How can I redirect a user to a specific page if they are already
authenticated?
if ($SESSION_Authenticated) { //code here to redirect; }

thanks



--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP-DB] redirect a page

2002-04-24 Thread John Hughes

If you really want to redirect and not just display a message that no
records were found, then this will work:

$num = mysql_numrows($result); 
if ($num == 0) 
{
 header(Location: sorry.php);
 exit;
} ELSE {
 while ...






--- Rankin, Randy [EMAIL PROTECTED] wrote:
 Nato,
 
 Try something like this:
 
 $num = mysql_numrows($result); 
 if ($num == 0) 
   
   {
   echo There were no records found.;
   }
 else
   while ...
 
 -Original Message-
 From: Natividad Castro [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, April 24, 2002 11:01 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] redirect a page
 
 
 Hi to all,
 I have a search form where users can search for a specific record;
 up to now
 is working fine, but what I would like to do is: if the record is
 not found,
 redirect them to another page that says that record was not found.
 Can
 anybody tell me how to do this? I already tried using this
 statement
 if ( !mysql_fetch_array($result) ) {
 include file // this the page that I want to redirect them, but it
 doen't
 work
 }
 
 I would like to execute the first statement it's false:
 e.g if name doesn't match with anything in the table, redirect to
 another
 page
 else execute the whole query.
 
$query = mysql_query(SELECT * from 150bk where trim(NAME) like
 '% .
 $legal_name . %');
 
while($query_data = mysql_fetch_array($query))
{
   $id = trim($query_data[ID]);
   $name = trim($query_data[NAME]);
   $tracking_num = trim($query_data[TRACKING_NUMBER]);
 $census = trim($query_data[CENSUS_NUM]);
 $name_dba = trim($query_data[NAME_DBA]);
 }
 
 Any help, it's greatly appreciate
 Thanks
 Nato
 
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


__
Do You Yahoo!?
Yahoo! Games - play chess, backgammon, pool and more
http://games.yahoo.com/

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP-DB] Redirect command?

2001-02-22 Thread Rick Emery

header ("Location: http://www.php.net"); /* Redirect browser 

-Original Message-
From: Julio Cuz, Jr. [mailto:[EMAIL PROTECTED]]
Sent: Thursday, February 22, 2001 4:23 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Redirect command?


Hi--

I've been looking for a "redirect" command (basically redirect from page a 
to page b if something happens)...

Julio Cuz, Jr.
Riverside Community College
[EMAIL PROTECTED]


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP-DB] Redirect command?

2001-02-22 Thread Mark Newnham

if ( $x==true) {
print "script language='javascript'\n";
print "window.open('b.php','_self');\n";
print "/script\n";
die;
}


 -Original Message-
 From: Julio Cuz, Jr. [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, February 22, 2001 3:23 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] Redirect command?
 
 
 Hi--
 
 I've been looking for a "redirect" command (basically 
 redirect from page a 
 to page b if something happens)...
 
 Julio Cuz, Jr.
 Riverside Community College
 [EMAIL PROTECTED]
 
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: 
 [EMAIL PROTECTED]
 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]