[PHP] What is wrong with this code?

2010-04-28 Thread Gary .
class Pg_Error
{
private static $errors =
array(INTEGRITY_CONST_UNIQUE = 'uniqueness constraint violated');
...
public static function getMessage($ec)
{
$text = '';
if (array_key_exists($ec, Pg_Error::$errors))
{
$text = Pg_Error::$errors[$ec];
}

return $text;
}
...
}

?

Calling it, the array_key_exists call always returns false:
$this-assertEquals('uniqueness constraint violated',
Pg_Error::getMessage(Pg_Error::INTEGRITY_CONST_UNIQUE));
and I can't see what I've done wrong :(

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



Re: [PHP] What is wrong with this code?

2010-04-28 Thread Per Jessen
Gary . wrote:

 class Pg_Error
 {
 private static $errors =
 array(INTEGRITY_CONST_UNIQUE = 'uniqueness constraint
 violated');
 ...
 public static function getMessage($ec)
 {
 $text = '';
 if (array_key_exists($ec, Pg_Error::$errors))
 {
 $text = Pg_Error::$errors[$ec];
 }
 
 return $text;
 }
 ...
 }
 
 ?
 
 Calling it, the array_key_exists call always returns false:
 $this-assertEquals('uniqueness constraint violated',
 Pg_Error::getMessage(Pg_Error::INTEGRITY_CONST_UNIQUE));
 and I can't see what I've done wrong :(

Might this be better:

public static function getMessage($ec)
{
$text = '';
if (array_key_exists($ec, $errors))
{
$text = $errors[$ec];
}

return $text;
}



-- 
Per Jessen, Zürich (11.2°C)


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



Re: [PHP] What is wrong with this code?

2010-04-28 Thread Peter Lind
On 28 April 2010 08:39, Gary . php-gene...@garydjones.name wrote:
 class Pg_Error
 {
    private static $errors =
        array(INTEGRITY_CONST_UNIQUE = 'uniqueness constraint violated');
 ...
    public static function getMessage($ec)
    {
        $text = '';
        if (array_key_exists($ec, Pg_Error::$errors))
        {
            $text = Pg_Error::$errors[$ec];
        }

        return $text;
    }
 ...
 }

 ?

 Calling it, the array_key_exists call always returns false:
 $this-assertEquals('uniqueness constraint violated',
 Pg_Error::getMessage(Pg_Error::INTEGRITY_CONST_UNIQUE));
 and I can't see what I've done wrong :(


In your code snippet, you do not declare
Pg_Error::INTEGRITY_CONST_UNIQUE - and equally to the point, in the
class you only use INTEGRITY_CONST_UNIQUE in the array, not
Pg_Error::INTEGRITY_CONST_UNIQUE

Regards
Peter

-- 
hype
WWW: http://plphp.dk / http://plind.dk
LinkedIn: http://www.linkedin.com/in/plind
Flickr: http://www.flickr.com/photos/fake51
BeWelcome: Fake51
Couchsurfing: Fake51
/hype

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



Re: [PHP] What is wrong with this code?

2010-04-28 Thread Gary .
Per Jessen wrote:
 Gary . wrote:

 Calling it, the array_key_exists call always returns false
...
 and I can't see what I've done wrong :(

 Might this be better:

 public static function getMessage($ec)
 {
 $text = '';
 if (array_key_exists($ec, $errors))
 {
 $text = $errors[$ec];
 }

 return $text;
 }

Well, not really...

1) Pg_Error_Test::testGetMessage_23505
array_key_exists() expects parameter 2 to be array, null given

(scope issue, I think - it assumes I am talking about a local $errors variable)

 Per Jessen, Zürich (11.2°C)
  ^^
Oh :) Maybe I should have just popped round and asked :))

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



Re: [PHP] What is wrong with this code?

2010-04-28 Thread Gary .
On 4/28/10, Jochem Maas wrote:
 Op 4/28/10 7:39 AM, Gary . schreef:
 class Pg_Error
 {
const INTEGRITY_CONST_UNIQUE = '23505';
 private static $errors =
 array(INTEGRITY_CONST_UNIQUE = 'uniqueness constraint violated');
 ...
 public static function getMessage($ec)
 {
 $text = '';
 if (array_key_exists($ec, Pg_Error::$errors))
 {
 $text = Pg_Error::$errors[$ec];
 }

 return $text;
 }
 ...
 }
...
 I'd be looking at making sure the constant 'INTEGRITY_CONST_UNIQUE' is
 actually
 defined before you load the class ...

I accidentally deleted it in the example I posted. Sorry. The actual
code includes the above const. But you put me on the right track, the
array entry wasn't using the const value as a key...

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



Re: [PHP] What is wrong with this code?

2010-04-28 Thread Gary .
On 4/28/10, Jochem Maas wrote:
  class Pg_Error
  {
const INTEGRITY_CONST_UNIQUE = '23505';

 this is a class constant

  private static $errors =
  array(INTEGRITY_CONST_UNIQUE = 'uniqueness constraint
 violated');
[...]
 unfortunately you cannot use a classes
 own
 constants in the definition of the $errors var

Huh? IWFM. Is it defined in the language that it does not work, or
might not work depending on the runtime environment? IMO it should
work (given the declaration order) but I know statics do have a
tendency (certainly in other laguages) to be somewhat special.

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



Re: [PHP] What is wrong with this code?

2010-04-28 Thread Peter Lind
On 28 April 2010 10:57, Gary . php-gene...@garydjones.name wrote:
 On 4/28/10, Jochem Maas wrote:
      class Pg_Error
      {
        const INTEGRITY_CONST_UNIQUE = '23505';

 this is a class constant

          private static $errors =
              array(INTEGRITY_CONST_UNIQUE = 'uniqueness constraint
     violated');
 [...]
 unfortunately you cannot use a classes
 own
 constants in the definition of the $errors var

 Huh? IWFM. Is it defined in the language that it does not work, or
 might not work depending on the runtime environment? IMO it should
 work (given the declaration order) but I know statics do have a
 tendency (certainly in other laguages) to be somewhat special.


Shouldn't be any problems using a classes constants in the definition
of an array in the same class. However, to avoid possible extra work
down the line, I wouldn't use Pg_Error::YOUR_CONSTANT inside the
class, I'd use self::YOUR_CONSTANT

Regards
Peter

-- 
hype
WWW: http://plphp.dk / http://plind.dk
LinkedIn: http://www.linkedin.com/in/plind
Flickr: http://www.flickr.com/photos/fake51
BeWelcome: Fake51
Couchsurfing: Fake51
/hype

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



Re: [PHP] What is wrong with this code?

2010-04-28 Thread Thijs Lensselink

Gary . wrote:

class Pg_Error
{
private static $errors =
array(INTEGRITY_CONST_UNIQUE = 'uniqueness constraint violated');
  

Shouldn't this be:

array(self::INTEGRITY_CONST_UNIQUE = 'uniqueness constraint violated');



...
public static function getMessage($ec)
{
$text = '';
if (array_key_exists($ec, Pg_Error::$errors))
{
$text = Pg_Error::$errors[$ec];
}

return $text;
}
...
}

?

Calling it, the array_key_exists call always returns false:
$this-assertEquals('uniqueness constraint violated',
Pg_Error::getMessage(Pg_Error::INTEGRITY_CONST_UNIQUE));
and I can't see what I've done wrong :(

  



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



Re: [PHP] What is wrong with this code?

2010-04-28 Thread Gary .
On 4/28/10, Thijs Lensselink wrote:
 Gary . wrote:
 class Pg_Error
 {
 private static $errors =
 array(INTEGRITY_CONST_UNIQUE = 'uniqueness constraint violated');

 Shouldn't this be:

 array(self::INTEGRITY_CONST_UNIQUE = 'uniqueness constraint violated');

Yes, or something very like it. See Message-ID:
y2la35643581004280018i22b3de1ag1a836e7229378...@mail.gmail.com

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



Re: [PHP] What is wrong with this code?

2010-04-28 Thread Thijs Lensselink

Gary . wrote:

On 4/28/10, Thijs Lensselink wrote:
  

Gary . wrote:


class Pg_Error
{
private static $errors =
array(INTEGRITY_CONST_UNIQUE = 'uniqueness constraint violated');

  

Shouldn't this be:

array(self::INTEGRITY_CONST_UNIQUE = 'uniqueness constraint violated');



Yes, or something very like it. See Message-ID:
y2la35643581004280018i22b3de1ag1a836e7229378...@mail.gmail.com

  

That message is about defining the class constant. Which is done.
But later on it is called as a normal constant. Not a class constant

Besides the fact that it should throw a notice. It also makes sure
Pg_Error::$errors looks a bit different then expected

array(1) {
 [INTEGRITY_CONST_UNIQUE]=
 string(30) uniqueness constraint violated
}

This makes Pg_Error::getMessage(23505) always return string(0) which 
equals false


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



Re: [PHP] What is wrong with this code?

2010-04-28 Thread Gary .
On Wed, Apr 28, 2010 at 2:17 PM, Thijs Lensselink wrote:
 Gary . wrote:
 On 4/28/10, Thijs Lensselink wrote:
 Gary . wrote:
 class Pg_Error
 {
    private static $errors =
        array(INTEGRITY_CONST_UNIQUE = 'uniqueness constraint
 violated');



 Shouldn't this be:

 array(self::INTEGRITY_CONST_UNIQUE = 'uniqueness constraint violated');


 Yes, or something very like it. See Message-ID:
 y2la35643581004280018i22b3de1ag1a836e7229378...@mail.gmail.com



 That message is about defining the class constant.

the array entry wasn't using the const value as a key...

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



Re: [PHP] What is wrong with this code

2009-04-18 Thread Reese

9el wrote:

*Note:* It is worth noting that the mail() function is not suitable for
larger volumes of email in a loop. This function opens and closes an SMTP
socket for each email, which is not very efficient.
For the sending of large amounts of email, see the » PEAR::Mail, and »
PEAR::Mail_Queue packages.
*
Note:* The following RFCs may be useful: » RFC 1896, » RFC 2045, » RFC 2046,
» RFC 2047, » RFC 2048, » RFC 2049, and » RFC 2822.

Copy from PHP Manual.


How is larger volumes of email defined where mail() is concerned?
Is a number specified anywhere? I didn't see one on the manual page
for mail().

Reese



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



Re: [PHP] What is wrong with this code

2009-04-18 Thread 9el
But in practice. I mean in real life you'll find the mail() function is
disabled in most servers :)


Re: [PHP] What is wrong with this code

2009-04-18 Thread Reese

9el wrote:

But in practice. I mean in real life you'll find the mail() function is
disabled in most servers :)


That's nice, but how many is larger volumes of email? 500? 5,000?
25,000?

I note PEAR:Mail has 3 open bugs, PEAR:Mail_Mime has 23 with 3 open
support requests. PHPMailer was mentioned earlier, it has 31 open
bugs (and someone noted that at least one was closed as resolved
even though it wasn't actually fixed).

So how many addresses can mail() safely handle?

Reese



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



Re: [PHP] What is wrong with this code

2009-04-18 Thread Manuel Lemos
Hello,

9el wrote:
 *Note:* It is worth noting that the mail() function is not suitable for
 larger volumes of email in a loop. This function opens and closes an SMTP
 socket for each email, which is not very efficient.
 For the sending of large amounts of email, see the » PEAR::Mail, and »
 PEAR::Mail_Queue packages.
 *
 Note:* The following RFCs may be useful: » RFC 1896, » RFC 2045, » RFC 2046,
 » RFC 2047, » RFC 2048, » RFC 2049, and » RFC 2822.
 
 Copy from PHP Manual.

The PHP manual is wrong. Using the mail function does not necessarily
make it open and close SMTP connections for every recipient. That is
true with PHP under Windows.

When you use sendmail or equivalent (Postfix, Qmail, etc..) on Linux
usually the message is just dropped in the queue and the mail server
takes it from there. PHP does not necessarily have to wait for the
message be delivered to the remote recipient via SMTP.

You may want to read a more complete explanation here:

http://www.phpclasses.org/blog/package/14/post/1-Sending-messages-to-many-recipients-via-SMTP-in-PHP.html


-- 

Regards,
Manuel Lemos

Find and post PHP jobs
http://www.phpclasses.org/jobs/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/


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



[PHP] What is wrong with this code

2009-04-03 Thread Gary
This is driving me nuts.  I am getting blank emails and the only information 
that is being passed to MySQL is the IP address.

Can someone tell me what is wrong with this?

form method=post action=?php echo $_SERVER['PHP_SELF']; ?
 div id=important style=visibility:hidden;
   pIf you can see this, it's an anti-spam measure.  Please don't
   fill in the address field./p
   label for=addressAddress/label
   input type=text name=address id=address //div

   label for=nameName:/label
   input name=name type=text /br /
   label for=emailEmail Address:/label
input name=email type=text /
br /
label for=nameComments:/label
textarea name=comments cols=50 rows=/textarea
input name=submit type=button value=submit //form

?php

// Receiving variables


$ip= $_SERVER['REMOTE_ADDR'];
$name = $_POST['name'];
$email = $_POST['email'];
$comments = $_POST['comments'];

//spam filter, do not touch
 if ($_POST['address'] != '' ){


die(Changed field);

}

//endo fo spam filter

$header = From: $email\n
. Reply-To: $email\n;
$subject = Response from Assessment Lawyer;
$email_to = sanitized;
$message = name: $name\n
. email: $email\n
. comments: $comments\n
.Visitors IP: $ip\n;
mail($email_to, $subject, $message, $header);




$dbc= mysqli_connect(sanitized,sanitized,sanitized,sanitized)// I have 
removed the actual information, but it was connecting!
or die('Could not connect to db');

$query = INSERT INTO sanitized VALUES(0,'$name', 
'$email','$comments','$ip');

$result = mysqli_query($dbc, $query)
or die('Error querying database.');



mysqli_close($dbc);

echo 'Thank you $name for submitting your inquiry!br /';
echo 'You have supplied the following information:br /';
echo 'Name: $name br /';
echo 'Email Address: $email br /';
echo 'Comments: $comments';

? 



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



Re: [PHP] What is wrong with this code

2009-04-03 Thread Igor Escobar
You forgot to mention the method of the form.

form action=... method=post ... /form

Regards,
Igor Escoar
Systems Analyst  Interface Designer

--

Personal Blog
~ blog.igorescobar.com
Online Portifolio
~ www.igorescobar.com
Twitter
~ @igorescobar





On Fri, Apr 3, 2009 at 4:08 PM, Gary gwp...@ptd.net wrote:

 This is driving me nuts.  I am getting blank emails and the only
 information
 that is being passed to MySQL is the IP address.

 Can someone tell me what is wrong with this?

 form method=post action=?php echo $_SERVER['PHP_SELF']; ?
  div id=important style=visibility:hidden;
   pIf you can see this, it's an anti-spam measure.  Please don't
   fill in the address field./p
   label for=addressAddress/label
   input type=text name=address id=address //div

   label for=nameName:/label
   input name=name type=text /br /
   label for=emailEmail Address:/label
 input name=email type=text /
 br /
 label for=nameComments:/label
 textarea name=comments cols=50 rows=/textarea
 input name=submit type=button value=submit //form

 ?php

 // Receiving variables


 $ip= $_SERVER['REMOTE_ADDR'];
 $name = $_POST['name'];
 $email = $_POST['email'];
 $comments = $_POST['comments'];

 //spam filter, do not touch
  if ($_POST['address'] != '' ){


 die(Changed field);

}

 //endo fo spam filter

 $header = From: $email\n
 . Reply-To: $email\n;
 $subject = Response from Assessment Lawyer;
 $email_to = sanitized;
 $message = name: $name\n
 . email: $email\n
 . comments: $comments\n
 .Visitors IP: $ip\n;
 mail($email_to, $subject, $message, $header);




 $dbc= mysqli_connect(sanitized,sanitized,sanitized,sanitized)// I have
 removed the actual information, but it was connecting!
 or die('Could not connect to db');

 $query = INSERT INTO sanitized VALUES(0,'$name',
 '$email','$comments','$ip');

 $result = mysqli_query($dbc, $query)
 or die('Error querying database.');



mysqli_close($dbc);

 echo 'Thank you $name for submitting your inquiry!br /';
 echo 'You have supplied the following information:br /';
 echo 'Name: $name br /';
 echo 'Email Address: $email br /';
 echo 'Comments: $comments';

 ?



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




Re: [PHP] What is wrong with this code

2009-04-03 Thread Gary
Its there...


Igor Escobar titiolin...@gmail.com wrote in message 
news:1f5251d50904031212o6fcc3e43q5c60b7ae373e9...@mail.gmail.com...
 You forgot to mention the method of the form.

 form action=... method=post ... /form

 Regards,
 Igor Escoar
 Systems Analyst  Interface Designer

 --

 Personal Blog
 ~ blog.igorescobar.com
 Online Portifolio
 ~ www.igorescobar.com
 Twitter
 ~ @igorescobar





 On Fri, Apr 3, 2009 at 4:08 PM, Gary gwp...@ptd.net wrote:

 This is driving me nuts.  I am getting blank emails and the only
 information
 that is being passed to MySQL is the IP address.

 Can someone tell me what is wrong with this?

 form method=post action=?php echo $_SERVER['PHP_SELF']; ?
  div id=important style=visibility:hidden;
   pIf you can see this, it's an anti-spam measure.  Please don't
   fill in the address field./p
   label for=addressAddress/label
   input type=text name=address id=address //div

   label for=nameName:/label
   input name=name type=text /br /
   label for=emailEmail Address:/label
 input name=email type=text /
 br /
 label for=nameComments:/label
 textarea name=comments cols=50 rows=/textarea
 input name=submit type=button value=submit //form

 ?php

 // Receiving variables


 $ip= $_SERVER['REMOTE_ADDR'];
 $name = $_POST['name'];
 $email = $_POST['email'];
 $comments = $_POST['comments'];

 //spam filter, do not touch
  if ($_POST['address'] != '' ){


 die(Changed field);

}

 //endo fo spam filter

 $header = From: $email\n
 . Reply-To: $email\n;
 $subject = Response from Assessment Lawyer;
 $email_to = sanitized;
 $message = name: $name\n
 . email: $email\n
 . comments: $comments\n
 .Visitors IP: $ip\n;
 mail($email_to, $subject, $message, $header);




 $dbc= mysqli_connect(sanitized,sanitized,sanitized,sanitized)// I have
 removed the actual information, but it was connecting!
 or die('Could not connect to db');

 $query = INSERT INTO sanitized VALUES(0,'$name',
 '$email','$comments','$ip');

 $result = mysqli_query($dbc, $query)
 or die('Error querying database.');



mysqli_close($dbc);

 echo 'Thank you $name for submitting your inquiry!br /';
 echo 'You have supplied the following information:br /';
 echo 'Name: $name br /';
 echo 'Email Address: $email br /';
 echo 'Comments: $comments';

 ?



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


 



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



RE: [PHP] What is wrong with this code

2009-04-03 Thread kyle.smith
Try something like print_r on $_POST to see if it contains *anything*,
seems like it's empty?!

Also, when you say blank emails I assume you mean they have the template
you made but the variables are empty and not zero-length emails.

-Original Message-
From: Gary [mailto:gwp...@ptd.net] 
Sent: Friday, April 03, 2009 3:14 PM
To: php-general@lists.php.net
Subject: Re: [PHP] What is wrong with this code

Its there...


Igor Escobar titiolin...@gmail.com wrote in message
news:1f5251d50904031212o6fcc3e43q5c60b7ae373e9...@mail.gmail.com...
 You forgot to mention the method of the form.

 form action=... method=post ... /form

 Regards,
 Igor Escoar
 Systems Analyst  Interface Designer

 --

 Personal Blog
 ~ blog.igorescobar.com
 Online Portifolio
 ~ www.igorescobar.com
 Twitter
 ~ @igorescobar





 On Fri, Apr 3, 2009 at 4:08 PM, Gary gwp...@ptd.net wrote:

 This is driving me nuts.  I am getting blank emails and the only 
 information that is being passed to MySQL is the IP address.

 Can someone tell me what is wrong with this?

 form method=post action=?php echo $_SERVER['PHP_SELF']; ?  
 div id=important style=visibility:hidden;
   pIf you can see this, it's an anti-spam measure.  Please don't
   fill in the address field./p
   label for=addressAddress/label
   input type=text name=address id=address //div

   label for=nameName:/label
   input name=name type=text /br /
   label for=emailEmail Address:/label input name=email 
 type=text / br / label for=nameComments:/label textarea 
 name=comments cols=50 rows=/textarea input name=submit 
 type=button value=submit //form

 ?php

 // Receiving variables


 $ip= $_SERVER['REMOTE_ADDR'];
 $name = $_POST['name'];
 $email = $_POST['email'];
 $comments = $_POST['comments'];

 //spam filter, do not touch
  if ($_POST['address'] != '' ){


 die(Changed field);

}

 //endo fo spam filter

 $header = From: $email\n
 . Reply-To: $email\n;
 $subject = Response from Assessment Lawyer; $email_to = 
 sanitized; $message = name: $name\n
 . email: $email\n
 . comments: $comments\n
 .Visitors IP: $ip\n;
 mail($email_to, $subject, $message, $header);




 $dbc= mysqli_connect(sanitized,sanitized,sanitized,sanitized)// I 
 have removed the actual information, but it was connecting!
 or die('Could not connect to db');

 $query = INSERT INTO sanitized VALUES(0,'$name', 
 '$email','$comments','$ip');

 $result = mysqli_query($dbc, $query)
 or die('Error querying database.');



mysqli_close($dbc);

 echo 'Thank you $name for submitting your inquiry!br /'; echo 'You 
 have supplied the following information:br /'; echo 'Name: $name 
 br /'; echo 'Email Address: $email br /'; echo 'Comments: 
 $comments';

 ?



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

 http://www.php.net/unsub.php


 



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


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



Re: [PHP] What is wrong with this code

2009-04-03 Thread Gary
I recieve an email, it will contain the ip address, it will also contain the 
name:, email: , comments:  but not the information from the form of the 
name or email or comments.

The database also recieves only the ip address.  So I assume those parts are 
working, but I cant seem to find why the others are not.

Thanks for your reply.

Gary

kyle.smith kyle.sm...@inforonics.com wrote in message 
news:d3fe56d174abf6469079ca1a5c8474a804fa9...@nsmail01.inforonics.corp...
Try something like print_r on $_POST to see if it contains *anything*,
seems like it's empty?!

Also, when you say blank emails I assume you mean they have the template
you made but the variables are empty and not zero-length emails.

-Original Message-
From: Gary [mailto:gwp...@ptd.net]
Sent: Friday, April 03, 2009 3:14 PM
To: php-general@lists.php.net
Subject: Re: [PHP] What is wrong with this code

Its there...


Igor Escobar titiolin...@gmail.com wrote in message
news:1f5251d50904031212o6fcc3e43q5c60b7ae373e9...@mail.gmail.com...
 You forgot to mention the method of the form.

 form action=... method=post ... /form

 Regards,
 Igor Escoar
 Systems Analyst  Interface Designer

 --

 Personal Blog
 ~ blog.igorescobar.com
 Online Portifolio
 ~ www.igorescobar.com
 Twitter
 ~ @igorescobar





 On Fri, Apr 3, 2009 at 4:08 PM, Gary gwp...@ptd.net wrote:

 This is driving me nuts.  I am getting blank emails and the only
 information that is being passed to MySQL is the IP address.

 Can someone tell me what is wrong with this?

 form method=post action=?php echo $_SERVER['PHP_SELF']; ?
 div id=important style=visibility:hidden;
   pIf you can see this, it's an anti-spam measure.  Please don't
   fill in the address field./p
   label for=addressAddress/label
   input type=text name=address id=address //div

   label for=nameName:/label
   input name=name type=text /br /
   label for=emailEmail Address:/label input name=email
 type=text / br / label for=nameComments:/label textarea
 name=comments cols=50 rows=/textarea input name=submit
 type=button value=submit //form

 ?php

 // Receiving variables


 $ip= $_SERVER['REMOTE_ADDR'];
 $name = $_POST['name'];
 $email = $_POST['email'];
 $comments = $_POST['comments'];

 //spam filter, do not touch
  if ($_POST['address'] != '' ){


 die(Changed field);

}

 //endo fo spam filter

 $header = From: $email\n
 . Reply-To: $email\n;
 $subject = Response from Assessment Lawyer; $email_to =
 sanitized; $message = name: $name\n
 . email: $email\n
 . comments: $comments\n
 .Visitors IP: $ip\n;
 mail($email_to, $subject, $message, $header);




 $dbc= mysqli_connect(sanitized,sanitized,sanitized,sanitized)// I
 have removed the actual information, but it was connecting!
 or die('Could not connect to db');

 $query = INSERT INTO sanitized VALUES(0,'$name',
 '$email','$comments','$ip');

 $result = mysqli_query($dbc, $query)
 or die('Error querying database.');



mysqli_close($dbc);

 echo 'Thank you $name for submitting your inquiry!br /'; echo 'You
 have supplied the following information:br /'; echo 'Name: $name
 br /'; echo 'Email Address: $email br /'; echo 'Comments:
 $comments';

 ?



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

 http://www.php.net/unsub.php






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



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



Re: [PHP] What is wrong with this code

2009-04-03 Thread Igor Escobar
If method POST is there and the information still empty...maybe you should
call to someone like a warlock... :D


Regards,
Igor Escoar
Systems Analyst  Interface Designer

--

Personal Blog
~ blog.igorescobar.com
Online Portifolio
~ www.igorescobar.com
Twitter
~ @igorescobar





On Fri, Apr 3, 2009 at 4:22 PM, Gary gwp...@ptd.net wrote:

 I recieve an email, it will contain the ip address, it will also contain
 the
 name:, email: , comments:  but not the information from the form of the
 name or email or comments.

 The database also recieves only the ip address.  So I assume those parts
 are
 working, but I cant seem to find why the others are not.

 Thanks for your reply.

 Gary

 kyle.smith kyle.sm...@inforonics.com wrote in message
 news:d3fe56d174abf6469079ca1a5c8474a804fa9...@nsmail01.inforonics.corp...
 Try something like print_r on $_POST to see if it contains *anything*,
 seems like it's empty?!

 Also, when you say blank emails I assume you mean they have the template
 you made but the variables are empty and not zero-length emails.

 -Original Message-
 From: Gary [mailto:gwp...@ptd.net]
 Sent: Friday, April 03, 2009 3:14 PM
 To: php-general@lists.php.net
 Subject: Re: [PHP] What is wrong with this code

 Its there...


 Igor Escobar titiolin...@gmail.com wrote in message
 news:1f5251d50904031212o6fcc3e43q5c60b7ae373e9...@mail.gmail.com...
  You forgot to mention the method of the form.
 
  form action=... method=post ... /form
 
  Regards,
  Igor Escoar
  Systems Analyst  Interface Designer
 
  --
 
  Personal Blog
  ~ blog.igorescobar.com
  Online Portifolio
  ~ www.igorescobar.com
  Twitter
  ~ @igorescobar
 
 
 
 
 
  On Fri, Apr 3, 2009 at 4:08 PM, Gary gwp...@ptd.net wrote:
 
  This is driving me nuts.  I am getting blank emails and the only
  information that is being passed to MySQL is the IP address.
 
  Can someone tell me what is wrong with this?
 
  form method=post action=?php echo $_SERVER['PHP_SELF']; ?
  div id=important style=visibility:hidden;
pIf you can see this, it's an anti-spam measure.  Please don't
fill in the address field./p
label for=addressAddress/label
input type=text name=address id=address //div
 
label for=nameName:/label
input name=name type=text /br /
label for=emailEmail Address:/label input name=email
  type=text / br / label for=nameComments:/label textarea
  name=comments cols=50 rows=/textarea input name=submit
  type=button value=submit //form
 
  ?php
 
  // Receiving variables
 
 
  $ip= $_SERVER['REMOTE_ADDR'];
  $name = $_POST['name'];
  $email = $_POST['email'];
  $comments = $_POST['comments'];
 
  //spam filter, do not touch
   if ($_POST['address'] != '' ){
 
 
  die(Changed field);
 
 }
 
  //endo fo spam filter
 
  $header = From: $email\n
  . Reply-To: $email\n;
  $subject = Response from Assessment Lawyer; $email_to =
  sanitized; $message = name: $name\n
  . email: $email\n
  . comments: $comments\n
  .Visitors IP: $ip\n;
  mail($email_to, $subject, $message, $header);
 
 
 
 
  $dbc= mysqli_connect(sanitized,sanitized,sanitized,sanitized)// I
  have removed the actual information, but it was connecting!
  or die('Could not connect to db');
 
  $query = INSERT INTO sanitized VALUES(0,'$name',
  '$email','$comments','$ip');
 
  $result = mysqli_query($dbc, $query)
  or die('Error querying database.');
 
 
 
 mysqli_close($dbc);
 
  echo 'Thank you $name for submitting your inquiry!br /'; echo 'You
  have supplied the following information:br /'; echo 'Name: $name
  br /'; echo 'Email Address: $email br /'; echo 'Comments:
  $comments';
 
  ?
 
 
 
  --
  PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:

  http://www.php.net/unsub.php
 
 
 



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



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




RE: [PHP] What is wrong with this code

2009-04-03 Thread kyle.smith
Well you're specifically missing anything that's in $_POST, which is why
I suggested getting yourself the exact contents of $_POST displayed to
the page. 

-Original Message-
From: Gary [mailto:gwp...@ptd.net] 
Sent: Friday, April 03, 2009 3:23 PM
To: php-general@lists.php.net
Subject: Re: [PHP] What is wrong with this code

I recieve an email, it will contain the ip address, it will also contain
the name:, email: , comments:  but not the information from the form of
the name or email or comments.

The database also recieves only the ip address.  So I assume those parts
are working, but I cant seem to find why the others are not.

Thanks for your reply.

Gary

kyle.smith kyle.sm...@inforonics.com wrote in message
news:d3fe56d174abf6469079ca1a5c8474a804fa9...@nsmail01.inforonics.corp..
.
Try something like print_r on $_POST to see if it contains *anything*,
seems like it's empty?!

Also, when you say blank emails I assume you mean they have the template
you made but the variables are empty and not zero-length emails.

-Original Message-
From: Gary [mailto:gwp...@ptd.net]
Sent: Friday, April 03, 2009 3:14 PM
To: php-general@lists.php.net
Subject: Re: [PHP] What is wrong with this code

Its there...


Igor Escobar titiolin...@gmail.com wrote in message
news:1f5251d50904031212o6fcc3e43q5c60b7ae373e9...@mail.gmail.com...
 You forgot to mention the method of the form.

 form action=... method=post ... /form

 Regards,
 Igor Escoar
 Systems Analyst  Interface Designer

 --

 Personal Blog
 ~ blog.igorescobar.com
 Online Portifolio
 ~ www.igorescobar.com
 Twitter
 ~ @igorescobar





 On Fri, Apr 3, 2009 at 4:08 PM, Gary gwp...@ptd.net wrote:

 This is driving me nuts.  I am getting blank emails and the only 
 information that is being passed to MySQL is the IP address.

 Can someone tell me what is wrong with this?

 form method=post action=?php echo $_SERVER['PHP_SELF']; ? 
 div id=important style=visibility:hidden;
   pIf you can see this, it's an anti-spam measure.  Please don't
   fill in the address field./p
   label for=addressAddress/label
   input type=text name=address id=address //div

   label for=nameName:/label
   input name=name type=text /br /
   label for=emailEmail Address:/label input name=email
 type=text / br / label for=nameComments:/label textarea 
 name=comments cols=50 rows=/textarea input name=submit
 type=button value=submit //form

 ?php

 // Receiving variables


 $ip= $_SERVER['REMOTE_ADDR'];
 $name = $_POST['name'];
 $email = $_POST['email'];
 $comments = $_POST['comments'];

 //spam filter, do not touch
  if ($_POST['address'] != '' ){


 die(Changed field);

}

 //endo fo spam filter

 $header = From: $email\n
 . Reply-To: $email\n;
 $subject = Response from Assessment Lawyer; $email_to = 
 sanitized; $message = name: $name\n
 . email: $email\n
 . comments: $comments\n
 .Visitors IP: $ip\n;
 mail($email_to, $subject, $message, $header);




 $dbc= mysqli_connect(sanitized,sanitized,sanitized,sanitized)// I 
 have removed the actual information, but it was connecting!
 or die('Could not connect to db');

 $query = INSERT INTO sanitized VALUES(0,'$name', 
 '$email','$comments','$ip');

 $result = mysqli_query($dbc, $query)
 or die('Error querying database.');



mysqli_close($dbc);

 echo 'Thank you $name for submitting your inquiry!br /'; echo 'You 
 have supplied the following information:br /'; echo 'Name: $name 
 br /'; echo 'Email Address: $email br /'; echo 'Comments:
 $comments';

 ?



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

 http://www.php.net/unsub.php






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



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


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



Re: [PHP] What is wrong with this code

2009-04-03 Thread Ray
On Friday 03 April 2009 13:08:45 Gary wrote:
 This is driving me nuts.  I am getting blank emails and the only
 information that is being passed to MySQL is the IP address.

 Can someone tell me what is wrong with this?

 form method=post action=?php echo $_SERVER['PHP_SELF']; ?
  div id=important style=visibility:hidden;
pIf you can see this, it's an anti-spam measure.  Please don't
fill in the address field./p
label for=addressAddress/label
input type=text name=address id=address //div

label for=nameName:/label
input name=name type=text /br /
label for=emailEmail Address:/label
 input name=email type=text /
 br /
 label for=nameComments:/label
 textarea name=comments cols=50 rows=/textarea
 input name=submit type=button value=submit //form
shouldn't this   be submit?

 ?php

 // Receiving variables


 $ip= $_SERVER['REMOTE_ADDR'];
 $name = $_POST['name'];
 $email = $_POST['email'];
 $comments = $_POST['comments'];


I hope this is simplified code, and you're going to do more filtering above?

 //spam filter, do not touch
  if ($_POST['address'] != '' ){


 die(Changed field);

 }

 //endo fo spam filter

 $header = From: $email\n
 . Reply-To: $email\n;
 $subject = Response from Assessment Lawyer;
 $email_to = sanitized;
 $message = name: $name\n
 . email: $email\n
 . comments: $comments\n
 .Visitors IP: $ip\n;
 mail($email_to, $subject, $message, $header);




 $dbc= mysqli_connect(sanitized,sanitized,sanitized,sanitized)// I have
 removed the actual information, but it was connecting!
 or die('Could not connect to db');

 $query = INSERT INTO sanitized VALUES(0,'$name',
 '$email','$comments','$ip');

 $result = mysqli_query($dbc, $query)
 or die('Error querying database.');



 mysqli_close($dbc);

 echo 'Thank you $name for submitting your inquiry!br /';
 echo 'You have supplied the following information:br /';
 echo 'Name: $name br /';
 echo 'Email Address: $email br /';
 echo 'Comments: $comments';

 ?



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



Re: [PHP] What is wrong with this code

2009-04-03 Thread Gary
Um, I dont understand that?


Igor Escobar titiolin...@gmail.com wrote in message 
news:1f5251d50904031228rfab0ec3rf8d9dd248b57e...@mail.gmail.com...
 If method POST is there and the information still empty...maybe you should
 call to someone like a warlock... :D


 Regards,
 Igor Escoar
 Systems Analyst  Interface Designer

 --

 Personal Blog
 ~ blog.igorescobar.com
 Online Portifolio
 ~ www.igorescobar.com
 Twitter
 ~ @igorescobar





 On Fri, Apr 3, 2009 at 4:22 PM, Gary gwp...@ptd.net wrote:

 I recieve an email, it will contain the ip address, it will also contain
 the
 name:, email: , comments:  but not the information from the form of the
 name or email or comments.

 The database also recieves only the ip address.  So I assume those parts
 are
 working, but I cant seem to find why the others are not.

 Thanks for your reply.

 Gary

 kyle.smith kyle.sm...@inforonics.com wrote in message
 news:d3fe56d174abf6469079ca1a5c8474a804fa9...@nsmail01.inforonics.corp...
 Try something like print_r on $_POST to see if it contains *anything*,
 seems like it's empty?!

 Also, when you say blank emails I assume you mean they have the template
 you made but the variables are empty and not zero-length emails.

 -Original Message-
 From: Gary [mailto:gwp...@ptd.net]
 Sent: Friday, April 03, 2009 3:14 PM
 To: php-general@lists.php.net
 Subject: Re: [PHP] What is wrong with this code

 Its there...


 Igor Escobar titiolin...@gmail.com wrote in message
 news:1f5251d50904031212o6fcc3e43q5c60b7ae373e9...@mail.gmail.com...
  You forgot to mention the method of the form.
 
  form action=... method=post ... /form
 
  Regards,
  Igor Escoar
  Systems Analyst  Interface Designer
 
  --
 
  Personal Blog
  ~ blog.igorescobar.com
  Online Portifolio
  ~ www.igorescobar.com
  Twitter
  ~ @igorescobar
 
 
 
 
 
  On Fri, Apr 3, 2009 at 4:08 PM, Gary gwp...@ptd.net wrote:
 
  This is driving me nuts.  I am getting blank emails and the only
  information that is being passed to MySQL is the IP address.
 
  Can someone tell me what is wrong with this?
 
  form method=post action=?php echo $_SERVER['PHP_SELF']; ?
  div id=important style=visibility:hidden;
pIf you can see this, it's an anti-spam measure.  Please don't
fill in the address field./p
label for=addressAddress/label
input type=text name=address id=address //div
 
label for=nameName:/label
input name=name type=text /br /
label for=emailEmail Address:/label input name=email
  type=text / br / label for=nameComments:/label textarea
  name=comments cols=50 rows=/textarea input name=submit
  type=button value=submit //form
 
  ?php
 
  // Receiving variables
 
 
  $ip= $_SERVER['REMOTE_ADDR'];
  $name = $_POST['name'];
  $email = $_POST['email'];
  $comments = $_POST['comments'];
 
  //spam filter, do not touch
   if ($_POST['address'] != '' ){
 
 
  die(Changed field);
 
 }
 
  //endo fo spam filter
 
  $header = From: $email\n
  . Reply-To: $email\n;
  $subject = Response from Assessment Lawyer; $email_to =
  sanitized; $message = name: $name\n
  . email: $email\n
  . comments: $comments\n
  .Visitors IP: $ip\n;
  mail($email_to, $subject, $message, $header);
 
 
 
 
  $dbc= mysqli_connect(sanitized,sanitized,sanitized,sanitized)// I
  have removed the actual information, but it was connecting!
  or die('Could not connect to db');
 
  $query = INSERT INTO sanitized VALUES(0,'$name',
  '$email','$comments','$ip');
 
  $result = mysqli_query($dbc, $query)
  or die('Error querying database.');
 
 
 
 mysqli_close($dbc);
 
  echo 'Thank you $name for submitting your inquiry!br /'; echo 'You
  have supplied the following information:br /'; echo 'Name: $name
  br /'; echo 'Email Address: $email br /'; echo 'Comments:
  $comments';
 
  ?
 
 
 
  --
  PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:

  http://www.php.net/unsub.php
 
 
 



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



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


 



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



Re: [PHP] What is wrong with this code

2009-04-03 Thread 9el
*Note:* It is worth noting that the mail() function is not suitable for
larger volumes of email in a loop. This function opens and closes an SMTP
socket for each email, which is not very efficient.
For the sending of large amounts of email, see the » PEAR::Mail, and »
PEAR::Mail_Queue packages.
*
Note:* The following RFCs may be useful: » RFC 1896, » RFC 2045, » RFC 2046,
» RFC 2047, » RFC 2048, » RFC 2049, and » RFC 2822.

Copy from PHP Manual.


RE: [PHP] What is wrong with this code

2009-04-03 Thread kyle.smith
This is unrelated, the email sends fine.  And it's one per submission. 

-Original Message-
From: doctortomor...@gmail.com [mailto:doctortomor...@gmail.com] On
Behalf Of 9el
Sent: Friday, April 03, 2009 3:37 PM
To: Gary
Cc: php-general@lists.php.net
Subject: Re: [PHP] What is wrong with this code

*Note:* It is worth noting that the mail() function is not suitable for
larger volumes of email in a loop. This function opens and closes an
SMTP socket for each email, which is not very efficient.
For the sending of large amounts of email, see the  PEAR::Mail, and 
PEAR::Mail_Queue packages.
*
Note:* The following RFCs may be useful:  RFC 1896,  RFC 2045,  RFC
2046,  RFC 2047,  RFC 2048,  RFC 2049, and  RFC 2822.

Copy from PHP Manual.

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



Re: [PHP] What is wrong with this code

2009-04-03 Thread Peter van der Does
On Fri, 3 Apr 2009 15:08:45 -0400
Gary gwp...@ptd.net wrote:

 This is driving me nuts.  I am getting blank emails and the only
 information that is being passed to MySQL is the IP address.
 
 Can someone tell me what is wrong with this?
 

If this is in one file, as I assume it is, here's what is happening:
In browser type the URL.
Load page.
Show form.
Send email.
Echo.
Done

You should check if information is send and if it's not don't process
the $_POST cause the $_POST is empty.

Simplified:
form method=post action=?php echo $_SERVER['PHP_SELF']; ?
 div id=important style=visibility:hidden;
   pIf you can see this, it's an anti-spam measure.  Please don't
   fill in the address field./p
   label for=addressAddress/label
   input type=text name=address id=address //div

   label for=nameName:/label
   input name=name type=text /br /
   label for=emailEmail Address:/label
input name=email type=text /
br /
label for=nameComments:/label
textarea name=comments cols=50 rows=/textarea
input name=submit type=button value=submit //form

?php

if ( isset( $_POST['submit'] ) ) {
// Receiving variables


$ip= $_SERVER['REMOTE_ADDR'];
... all other stuff

echo 'Thank you $name for submitting your inquiry!br /';
echo 'You have supplied the following information:br /';
echo 'Name: $name br /';
echo 'Email Address: $email br /';
echo 'Comments: $comments';
}
?

-- 
Peter van der Does

GPG key: E77E8E98
IRC: Ganseki on irc.freenode.net
Blog: http://blog.avirtualhome.com
Forums: http://forums.avirtualhome.com
Jabber ID: pvanderd...@gmail.com

GetDeb Package Builder
http://www.getdeb.net - Software you want for Ubuntu

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



Re: [PHP] What is wrong with this code

2009-04-03 Thread Gary
Peter

I had the

if ( isset( $_POST['submit'] ) ) {

in there and it did not work.

I have used this on several sites, the only difference is that I was tyring 
to contain it in one file.  I also created a file just to process the POST, 
but it still did not work.

I was thinkning it was something really simple like a mistyped word or 
misplaced  or ' or ().


Peter van der Does pvanderd...@gmail.com wrote in message 
news:20090403154906.35844...@montecarlo.grandprix.int...
 On Fri, 3 Apr 2009 15:08:45 -0400
 Gary gwp...@ptd.net wrote:

 This is driving me nuts.  I am getting blank emails and the only
 information that is being passed to MySQL is the IP address.

 Can someone tell me what is wrong with this?


 If this is in one file, as I assume it is, here's what is happening:
 In browser type the URL.
 Load page.
 Show form.
 Send email.
 Echo.
 Done

 You should check if information is send and if it's not don't process
 the $_POST cause the $_POST is empty.

 Simplified:
 form method=post action=?php echo $_SERVER['PHP_SELF']; ?
 div id=important style=visibility:hidden;
   pIf you can see this, it's an anti-spam measure.  Please don't
   fill in the address field./p
   label for=addressAddress/label
   input type=text name=address id=address //div

   label for=nameName:/label
   input name=name type=text /br /
   label for=emailEmail Address:/label
 input name=email type=text /
 br /
 label for=nameComments:/label
 textarea name=comments cols=50 rows=/textarea
 input name=submit type=button value=submit //form

 ?php

 if ( isset( $_POST['submit'] ) ) {
 // Receiving variables


 $ip= $_SERVER['REMOTE_ADDR'];
 ... all other stuff

 echo 'Thank you $name for submitting your inquiry!br /';
 echo 'You have supplied the following information:br /';
 echo 'Name: $name br /';
 echo 'Email Address: $email br /';
 echo 'Comments: $comments';
 }
 ?

 -- 
 Peter van der Does

 GPG key: E77E8E98
 IRC: Ganseki on irc.freenode.net
 Blog: http://blog.avirtualhome.com
 Forums: http://forums.avirtualhome.com
 Jabber ID: pvanderd...@gmail.com

 GetDeb Package Builder
 http://www.getdeb.net - Software you want for Ubuntu 



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



Re: [PHP] What is wrong with this code

2009-04-03 Thread 9el
---
Use FreeOpenSourceSoftwares, Stop piracy, Let the developers live. Get
a Free CD of Ubuntu mailed to your door without any cost. Visit :
www.ubuntu.com
--


On Sat, Apr 4, 2009 at 1:56 AM, Gary gwp...@ptd.net wrote:

 Peter

 I had the

 if ( isset( $_POST['submit'] ) ) {

 in there and it did not work.

  

 input name=submit type=button value=submit //form
shouldn't this   be submit?

Ray notified you of this try it out :)


Re: [PHP] What is wrong with this code

2009-04-03 Thread Gary
That was it, but Im sorry, I did not see that Ray had already pointed that 
out, so apologies to Ray and many thanks to everyone...

gary


9el le...@phpxperts.net wrote in message 
news:79d892150904031305j6e1b00d4qed0d9fbf13437...@mail.gmail.com...
 ---
 Use FreeOpenSourceSoftwares, Stop piracy, Let the developers live. Get
 a Free CD of Ubuntu mailed to your door without any cost. Visit :
 www.ubuntu.com
 --


 On Sat, Apr 4, 2009 at 1:56 AM, Gary gwp...@ptd.net wrote:

 Peter

 I had the

 if ( isset( $_POST['submit'] ) ) {

 in there and it did not work.

  

 input name=submit type=button value=submit //form
 shouldn't this   be submit?

 Ray notified you of this try it out :)
 



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



RE: [PHP] What is wrong with this code

2009-04-03 Thread kyle.smith
Wow can't believe I missed that.  I also was wondering why Ray mailed an
empty message... :) 

-Original Message-
From: doctortomor...@gmail.com [mailto:doctortomor...@gmail.com] On
Behalf Of 9el
Sent: Friday, April 03, 2009 4:05 PM
To: Gary
Cc: php-general@lists.php.net
Subject: Re: [PHP] What is wrong with this code

---
Use FreeOpenSourceSoftwares, Stop piracy, Let the developers live. Get a
Free CD of Ubuntu mailed to your door without any cost. Visit :
www.ubuntu.com
--


On Sat, Apr 4, 2009 at 1:56 AM, Gary gwp...@ptd.net wrote:

 Peter

 I had the

 if ( isset( $_POST['submit'] ) ) {

 in there and it did not work.

  

 input name=submit type=button value=submit //form
shouldn't this   be submit?

Ray notified you of this try it out :)

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



Re: [PHP] What is wrong with next code

2004-11-02 Thread Vladimir Shiray

Have anyone answers on the strange behaviour discussed in the thread ?


 
 I has noted specially:
   It works OK in PHP 4.3.6 or when line $db2 = 0; had been commented
   in all described versions of PHP.
 
 So next example works perfect:
 -
 error_reporting(E_ALL);
 $db1 = mysql_connect ('localhost', 'test', '1');
 $db2 = mysql_connect ('localhost', 'test', '1');
 mysql_close($db2);
 $result = mysql_query('SELECT 1+1', $db1);
 if ($result)
 {
 $row = mysql_fetch_row($result);
 echo Result: {$row[0]}\n;
 }
 -
 [EMAIL PROTECTED]:~/src/PHP# php -q mysql_connect3.php
 Result: 2
 
 
 
 On Thu, 28 Oct 2004 23:08:39 -0400
 John Holmes [EMAIL PROTECTED] wrote:
 
  Vladimir Shiray wrote:
   -
   Warning: mysql_query(): 4 is not a valid MySQL-Link resource in ...
 $result = mysql_query('SELECT 1+1', $db1);
   -
  [snip]
   $db1 = mysql_connect ('localhost', 'test', '1');
   $db2 = mysql_connect ('localhost', 'test', '1');
   mysql_close($db2);
  
  If you connect with the same parameters, PHP will just reuse the 
  previous connection. So you only have one connection and closing either 
  one will result in the connection being lost, hence the invalid link 
  resource message.
  
  -- 
  
  ---John Holmes...
  
  Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
  
  php|architect: The Magazine for PHP Professionals _ www.phparch.com
  
  

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



Re: [PHP] What is wrong with next code

2004-10-29 Thread Vladimir Shiray

I has noted specially:
  It works OK in PHP 4.3.6 or when line $db2 = 0; had been commented
  in all described versions of PHP.

So next example works perfect:
-
error_reporting(E_ALL);
$db1 = mysql_connect ('localhost', 'test', '1');
$db2 = mysql_connect ('localhost', 'test', '1');
mysql_close($db2);
$result = mysql_query('SELECT 1+1', $db1);
if ($result)
{
$row = mysql_fetch_row($result);
echo Result: {$row[0]}\n;
}
-
[EMAIL PROTECTED]:~/src/PHP# php -q mysql_connect3.php
Result: 2



On Thu, 28 Oct 2004 23:08:39 -0400
John Holmes [EMAIL PROTECTED] wrote:

 Vladimir Shiray wrote:
  -
  Warning: mysql_query(): 4 is not a valid MySQL-Link resource in ...
$result = mysql_query('SELECT 1+1', $db1);
  -
 [snip]
  $db1 = mysql_connect ('localhost', 'test', '1');
  $db2 = mysql_connect ('localhost', 'test', '1');
  mysql_close($db2);
 
 If you connect with the same parameters, PHP will just reuse the 
 previous connection. So you only have one connection and closing either 
 one will result in the connection being lost, hence the invalid link 
 resource message.
 
 -- 
 
 ---John Holmes...
 
 Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
 
 php|architect: The Magazine for PHP Professionals _ www.phparch.com
 
 

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



[PHP] What is wrong with next code

2004-10-28 Thread Vladimir Shiray
Can one explain me why I has got a result:
-
Warning: mysql_query(): 4 is not a valid MySQL-Link resource in ...
  $result = mysql_query('SELECT 1+1', $db1);
-
from next example.

The example does not work correctly (as I expect) in PHP 4.3.8, 4.3.9, 5.0.2
It works OK in PHP 4.3.6 or when line $db2 = 0; had been commented
in all described versions of PHP.

If it's a correct behaviour in new versions of PHP so
how can I free/unset $db2 variable without triggering
such effect?

-
error_reporting(E_ALL);
$db1 = mysql_connect ('localhost', 'test', '1');
$db2 = mysql_connect ('localhost', 'test', '1');
mysql_close($db2);
$db2 = 0;
$result = mysql_query('SELECT 1+1', $db1);
if ($result)
{
$row = mysql_fetch_row($result);
echo Result: {$row[0]}\n;
}
-

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



Re: [PHP] What is wrong with next code

2004-10-28 Thread John Holmes
Vladimir Shiray wrote:
-
Warning: mysql_query(): 4 is not a valid MySQL-Link resource in ...
  $result = mysql_query('SELECT 1+1', $db1);
-
[snip]
$db1 = mysql_connect ('localhost', 'test', '1');
$db2 = mysql_connect ('localhost', 'test', '1');
mysql_close($db2);
If you connect with the same parameters, PHP will just reuse the 
previous connection. So you only have one connection and closing either 
one will result in the connection being lost, hence the invalid link 
resource message.

--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals  www.phparch.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] What is wrong with this code ?

2003-09-15 Thread Daniel Szasz
Hello

What is wrong with this code ?

$doWork = $_GET[doWork];

echo $doWork;
echo ( BR);
if ( $doWork = 0) {
  exit;
}
else
{
  if ( $doWork = 1) {
  ?
  input class=no type=button value=Accept onClick=doAccept();
  input class=no type=button value=Reject onClick=doReject();
  ?
  };
  if ( $doWork = 2) {
echo ( call request accepted);
  };
  if ( $doWork = 3) {
echo ( call request rejected);
  }
}

I still got in the page the 2 buttons and the 2 echo's from doWork = 2 and
doWork = 3.

Thanks

Daniel

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



Re: [PHP] What is wrong with this code ?

2003-09-15 Thread Robert Cummings
On Mon, 2003-09-15 at 15:29, Daniel Szasz wrote:
 Hello
 
 What is wrong with this code ?
 
 $doWork = $_GET[doWork];

This is sloppy, put the quotes around the key string doWork.

 echo $doWork;
 echo ( BR);
 if ( $doWork = 0) {

You just assigned 0 to $doWork, try using 0 == $doWork

   exit;
 }
 else
 {
   if ( $doWork = 1) {

Once again, assignment when comparison is probably intended.

   ?
   input class=no type=button value=Accept onClick=doAccept();
   input class=no type=button value=Reject onClick=doReject();
   ?
   };
   if ( $doWork = 2) {

Yet again with the assignment.

 echo ( call request accepted);
   };
   if ( $doWork = 3) {

Another assignment, but now it's a string, not even any consistency.

 echo ( call request rejected);
   }
 }
 
 I still got in the page the 2 buttons and the 2 echo's from doWork = 2 and
 doWork = 3.

Looks like you're a coding slob IMHO.

Rob.
-- 
.-.
| Worlds of Carnage - http://www.wocmud.org   |
:-:
| Come visit a world of myth and legend where |
| fantastical creatures come to life and the  |
| stuff of nightmares grasp for your soul.|
`-'

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



Re: [PHP] What is wrong with this code ?

2003-09-15 Thread Miroslaw Milewski
Daniel Szasz wrote:

  What is wrong with this code ?

 == instead of =.

--

	miro.

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


RE: [PHP] What is wrong with this code ?

2003-09-15 Thread Carl Furst
If should use double equals for comparison.. if ($doWork == 1) { etc here}.
Of course doing multiple tests like this you are better off using switch
case...


Switch ($doWork) {
Case 0:
Exit;
Break;
Case 1:
DoOne($arguments);
Break;
Case 2:
DoTwo($arguments);
Break;
}
each number after the case statement is the value that $doWork will be
tested against.. look up Switch in the php manual, it's behavior can be a
bit weird especially if you forget to break if you don't break it's like
an OR statement/gate;

Carl.

-Original Message-
From: Daniel Szasz [mailto:[EMAIL PROTECTED]
Sent: Monday, September 15, 2003 3:29 PM
To: [EMAIL PROTECTED]
Subject: [PHP] What is wrong with this code ?

Hello

What is wrong with this code ?

$doWork = $_GET[doWork];

echo $doWork;
echo ( BR);
if ( $doWork = 0) {
  exit;
}
else
{
  if ( $doWork = 1) {
  ?
  input class=no type=button value=Accept onClick=doAccept();
  input class=no type=button value=Reject onClick=doReject();
  ?
  };
  if ( $doWork = 2) {
echo ( call request accepted);
  };
  if ( $doWork = 3) {
echo ( call request rejected);
  }
}

I still got in the page the 2 buttons and the 2 echo's from doWork = 2 and
doWork = 3.

Thanks

Daniel

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

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