Re: [PHP-DB] how to connect new html page in PHP.

2004-12-25 Thread graeme
The following two scripts should help you...
in file Page1.php
?php
echo Hello this is the first page br\n;
echo This is in file Page1.phpbr\n;
echo form method=\POST\ action=\Page2.php\\n;
echo \tinput type=\submit\ name=\submit\ value=\Next Page\\n;
echo /form\n;
echo Note the input button must be wrapped in a form tagbr;
echo 'Also the name attribute is the variable name that will be held in 
the $_POST variable';
?

in file Page2.php
?php
echo We're now in Page2.phpbr\n;
echo 'The submit variable is held in the $_POST variablebr';
echo $_POST[submit];
echo brTo find out what has been POSTed use the var_dump functionbr\n;
echo pre\n;
var_dump($_POST);
echo /pre\n;
?
graeme
amol patil wrote:
hallo ,
i wrote this ,   echo Submit = $submit;as you said.
but comments in echo statements are appearing on same pages before clicking 
submit button
and in between same pages content .
i want these comment on new page or same page but without original content of 
that page
how to connect new html page in PHP after clicking submit button
let simple code is like this,
?php
echo --Submit= $submit--;
if ($submit)
   {
   $dbh=mysql_connect (localhost, root, ) or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db (dollar1_allinfo);  

   mysql_query(INSERT INTO totalinfo (username,password,) VALUES 
('$loginusername','$loginpassword',));
echo'thank you';
   echo' Hurry Up';
}  
?

THANK YOU.
Mike S. [EMAIL PROTECTED] wrote:
 

hallo ,
i have wriiten simple php script , below.
created databse dollar1_allinfo with table 'totalinfo'
but on clicking submit button ,
information entered is not entering in database.
also, echo statements are also not displaying after submit
   

if ($submit)
 

{
$db = mysql_connect(localhost,root);
mysql_select_db(dollar1_allinfo,$db);
mysql_query(INSERT INTO totalinfo (username,password,) VALUES
('$loginusername','$loginpassword'));
echo 'thank you';
echo 'So Hurry Up';
}
?
thank you.
   

Because your query and echoes are within an if block, I'd say that
$submit is evaluating to FALSE, and thus not executing the query and
echoes.
Add (before the if statement):
echo Submit = $submit;
Make sure that $submit is evaluating to TRUE.
To All Beginning Programmers (Newbies), or just people who want to
easily debug their code:
Try adding debugging statements to help you find problems. A few echoes
or prints in selected locations will help identify the issue. Make sure
your variables are evaluating to values that you think they should be.
If you want to keep the debugging statements in your code and just
activate them when you need to see them, do something like:
// near the top of your code
$debug=TRUE;
// and anywehere in your code
if ($debug) {
echo DEBUG: Submit = $submit
\n;
}
// or whatever echo might help you nail down the problem. Put as many of
these in your code and you can turm them ON and OFF very easily, by
changing one line of code.
OR for even quicker debugging, replace $debug=TRUE; with
$debug=$_GET['debug'];
and then you can turn it on in by adding ?debug=TRUE at the end of the
URL. Example: http://www.php.net/path/my.html?debug=TRUE
or: http://www.php.net/path/my.html?debug=1
**DISCLAIMER** Using the URL method is NOT a secure way to do this!!! 
And I'm sure there's plenty of folks groaning out there because it is a
BIG security hole. You really would want to do this on a development
machine and network, and remove the debug code for production. That
really should go without saying.

Good luck.
:Mike S.
:Austin TX USA


		
-
Do you Yahoo!?
Jazz up your holiday email with celebrity designs. Learn more.
 



Re: [PHP-DB] how to connect new html page in PHP.

2004-12-25 Thread Zareef Ahmed
Hi, 

 A simple example of the code. It send email and when it sends email
it does not display the original form.

Please note the use of isset() and submit button name use.

zareef ahmed 

?php
if(isset($_POST['sendmail']))
{
$to=$_POST['to'];
$sub=$_POST['sub'];
$message=$_POST['message'];

$header=from:[EMAIL PROTECTED] \n\r\n\r;


if(mail($to,$sub,$message,$header))
{
echo Mail successfully sent;
echo brbr a href='http://www.bankdrt.com/mail_test.php'Test Again/a;
}else
{
echo Mail function fail;
}


}
else
{
?

form method=post action=?php $_SERVER['PHP_SELF']; ?
To :: input type=text name=to size=30
br
Subject :: input type=text name=sub size=50
br
Message br
textarea name=message rows=8 cols=50

/textarea
brbr
input type=submit name=sendmail value=send
/form
brbr
?php
}
?



-- 
Zareef Ahmed :: A PHP Developer in India ( Delhi )
Homepage :: http://www.zareef.net

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



Re: [PHP-DB] how to connect new html page in PHP.

2004-12-25 Thread Zareef Ahmed
Please remove url bankdrt.com from example. it was included accidently.

zareef ahmed 


On Sat, 25 Dec 2004 14:02:58 +0530, Zareef Ahmed [EMAIL PROTECTED] wrote:
 Hi,
 
 A simple example of the code. It send email and when it sends email
 it does not display the original form.
 
 Please note the use of isset() and submit button name use.
 
 zareef ahmed
 
 ?php
 if(isset($_POST['sendmail']))
 {
 $to=$_POST['to'];
 $sub=$_POST['sub'];
 $message=$_POST['message'];
 
 $header=from:[EMAIL PROTECTED] \n\r\n\r;
 
 if(mail($to,$sub,$message,$header))
 {
 echo Mail successfully sent;
 echo brbr a href='http://www.bankdrt.com/mail_test.php'Test Again/a;
 }else
 {
 echo Mail function fail;
 }
 
 }
 else
 {
 ?
 
 form method=post action=?php $_SERVER['PHP_SELF']; ?
 To :: input type=text name=to size=30
 br
 Subject :: input type=text name=sub size=50
 br
 Message br
 textarea name=message rows=8 cols=50
 
 /textarea
 brbr
 input type=submit name=sendmail value=send
 /form
 brbr
 ?php
 }
 ?
 
 
 --
 Zareef Ahmed :: A PHP Developer in India ( Delhi )
 Homepage :: http://www.zareef.net
 


-- 
Zareef Ahmed :: A PHP Developer in India ( Delhi )
Homepage :: http://www.zareef.net

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



Re: [PHP-DB] how to connect new html page in PHP.

2004-12-25 Thread Jason Wong
On Saturday 25 December 2004 16:32, Zareef Ahmed wrote:

 $header=from:[EMAIL PROTECTED] \n\r\n\r;

The newlines should be \r\n and not \n\r.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
/*
Time goes, you say?
Ah no!
Time stays, *we* go.
  -- Austin Dobson
*/

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



Re: [PHP-DB] how to connect new html page in PHP.

2004-12-25 Thread Jason Wong
On Saturday 25 December 2004 17:07, Zareef Ahmed wrote:
 On Sat, 25 Dec 2004 16:41:40 +0800, Jason Wong [EMAIL PROTECTED] wrote:
  On Saturday 25 December 2004 16:32, Zareef Ahmed wrote:
   $header=from:[EMAIL PROTECTED] \n\r\n\r;
 
  The newlines should be \r\n and not \n\r.

 Does it really make a diffrence?

Yes. Some of the security problems with Outlook stems from MS's strict 
non-compliance with the standards. And it takes just as much effort doing it 
incorrectly by using '\n\r' as it does doing it correctly using '\r\n' :)

Also if there is only a single header in $header then there is no need for 
'\r\n' at all. You only need it to separate multiple headers, and even then 
you should not use two sets of them, ie:

correct: \r\n
  incorrect: \r\n\r\n

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
/*
The solution to a problem changes the nature of the problem.
  -- Peer
*/

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



Re: [PHP-DB] how to connect new html page in PHP.

2004-12-25 Thread Zareef Ahmed
On Sat, 25 Dec 2004 17:27:18 +0800, Jason Wong [EMAIL PROTECTED] wrote:
 On Saturday 25 December 2004 17:07, Zareef Ahmed wrote:
  On Sat, 25 Dec 2004 16:41:40 +0800, Jason Wong [EMAIL PROTECTED] wrote:
   On Saturday 25 December 2004 16:32, Zareef Ahmed wrote:
$header=from:[EMAIL PROTECTED] \n\r\n\r;
  
   The newlines should be \r\n and not \n\r.
 
  Does it really make a diffrence?
 
 Yes. Some of the security problems with Outlook stems from MS's strict
 non-compliance with the standards. And it takes just as much effort doing it
 incorrectly by using '\n\r' as it does doing it correctly using '\r\n' :)
Thanks a lot for your information.
 
 Also if there is only a single header in $header then there is no need for
 '\r\n' at all. You only need it to separate multiple headers, and even then
 you should not use two sets of them, ie:
 
 correct: \r\n
   incorrect: \r\n\r\n
 
Sorry code was very old and for testing purpose only.  I just paste it
from my one of my old project for the example purpose only. I did not
check  it for such things (multiple headers, double use of \r\n etc.)
as main topic was use of isset and form submission. (Thats why it have
bankdrt.com as url , it belongs to  my previous employer ). Thanks
again for your information.

zareef ahmed
 --
 Jason Wong - Gremlins Associates - www.gremlins.biz
 Open Source Software Systems Integrators
 * Web Design  Hosting * Internet  Intranet Applications Development *
 --
 Search the list archives before you post
 http://marc.theaimsgroup.com/?l=php-db
 --
 /*
 The solution to a problem changes the nature of the problem.
   -- Peer
 */
 
 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 


-- 
Zareef Ahmed :: A PHP Developer in India ( Delhi )
Homepage :: http://www.zareef.net

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



[PHP-DB] how to connect new html page in PHP.

2004-12-24 Thread amol patil

hallo ,
 
i wrote this ,   echo Submit = $submit;as you said.
 
but comments in echo statements are appearing on same pages before clicking 
submit button
and in between same pages content .
 
i want these comment on new page or same page but without original content of 
that page
 
how to connect new html page in PHP after clicking submit button
let simple code is like this,
 
?php

echo --Submit= $submit--;
if ($submit)
{
$dbh=mysql_connect (localhost, root, ) or die ('I cannot connect to the 
database because: ' . mysql_error());
mysql_select_db (dollar1_allinfo);  

mysql_query(INSERT INTO totalinfo (username,password,) VALUES 
('$loginusername','$loginpassword',));

 
 echo'thank you';
echo' Hurry Up';

}  
 ?
 

THANK YOU.
Mike S. [EMAIL PROTECTED] wrote:
 hallo ,

 i have wriiten simple php script , below.
 created databse dollar1_allinfo with table 'totalinfo'

 but on clicking submit button ,

 information entered is not entering in database.

 also, echo statements are also not displaying after submit

  if ($submit)
 {
 $db = mysql_connect(localhost,root);
 mysql_select_db(dollar1_allinfo,$db);
 mysql_query(INSERT INTO totalinfo (username,password,) VALUES
 ('$loginusername','$loginpassword'));
 echo 'thank you';
 echo 'So Hurry Up';
 }
 ?

 thank you.

Because your query and echoes are within an if block, I'd say that
$submit is evaluating to FALSE, and thus not executing the query and
echoes.

Add (before the if statement):

echo Submit = $submit;

Make sure that $submit is evaluating to TRUE.


To All Beginning Programmers (Newbies), or just people who want to
easily debug their code:
Try adding debugging statements to help you find problems. A few echoes
or prints in selected locations will help identify the issue. Make sure
your variables are evaluating to values that you think they should be.

If you want to keep the debugging statements in your code and just
activate them when you need to see them, do something like:
// near the top of your code
$debug=TRUE;
// and anywehere in your code
if ($debug) {
echo DEBUG: Submit = $submit
\n;
}
// or whatever echo might help you nail down the problem. Put as many of
these in your code and you can turm them ON and OFF very easily, by
changing one line of code.

OR for even quicker debugging, replace $debug=TRUE; with
$debug=$_GET['debug'];
and then you can turn it on in by adding ?debug=TRUE at the end of the
URL. Example: http://www.php.net/path/my.html?debug=TRUE
or: http://www.php.net/path/my.html?debug=1
**DISCLAIMER** Using the URL method is NOT a secure way to do this!!! 
And I'm sure there's plenty of folks groaning out there because it is a
BIG security hole. You really would want to do this on a development
machine and network, and remove the debug code for production. That
really should go without saying.

Good luck.

:Mike S.
:Austin TX USA






-
Do you Yahoo!?
 Jazz up your holiday email with celebrity designs. Learn more.