Re: [PHP]

2010-07-04 Thread te0t3l
Thanks Ash, and so sorry I forgot to use the subject...

ok, I'll read about insertBefore () method,

Regards,

te0


[PHP] HTML in emails

2010-07-04 Thread Al

I know this is a bit off-topic; but close enough.

I'm starting to update the email feature of one of my DB applications and 
noticed that it appears most of the fancy emails I receive are using just plain 
old, simple html pages, with a note about not being able to see, go here with a 
link.


It use to be that we specified content-type text/html, etc. and sent both the 
plain ASCII and the html with boundaries and so forth.


Seems like, from my preliminary Google searching, I should not waste time with 
the standard's way and just go straight to sending simple html pages since all 
modern browsers handle it well. And, it appears to be the way web is going.


What are you folks doing?

Al..

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



Re: [PHP] HTML in emails

2010-07-04 Thread Per Jessen
Al wrote:

 I know this is a bit off-topic; but close enough.
 
 I'm starting to update the email feature of one of my DB applications
 and noticed that it appears most of the fancy emails I receive are
 using just plain old, simple html pages, with a note about not being
 able to see, go here with a link.
 
 It use to be that we specified content-type text/html, etc. and sent
 both the plain ASCII and the html with boundaries and so forth.

Yes, multipart/alternative that was. 

 Seems like, from my preliminary Google searching, I should not waste
 time with the standard's way and just go straight to sending simple
 html pages since all modern browsers handle it well. 
 And, it appears to be the way web is going.
 
 What are you folks doing?

We follow the standard and send both text and html. 



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


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



[PHP] Re: HTML in emails

2010-07-04 Thread Jonesy
On Sun, 04 Jul 2010 11:43:59 -0400, Al wrote:
 I know this is a bit off-topic; but close enough.

 I'm starting to update the email feature of one of my DB applications and 
 noticed that it appears most of the fancy emails I receive are using just 
 plain 
 old, simple html pages, with a note about not being able to see, go here with 
 a 
 link.

 It use to be that we specified content-type text/html, etc. and sent both the 
 plain ASCII and the html with boundaries and so forth.

 Seems like, from my preliminary Google searching, I should not waste time 
 with 
 the standard's way and just go straight to sending simple html pages since 
 all 
 modern browsers handle it well. And, it appears to be the way web is going.

 What are you folks doing?

In general, I simply do _not_ read fancy emails.Alpine 2.00 here.
I *browse* with a browser -- nothing more.

html in email seems to be all about eye candy -- not content.
I don't waste time looking for the 'content' in an email where it 
appears more effort was applied to the dancing elephants and 
flying pigs than was put into the message.

Jonesy
-- 
  Marvin L Jones| jonz  | W3DHJ  | linux
   38.24N  104.55W  |  @ config.com | Jonesy |  OS/2
* Killfiling google  banter.com: jonz.net/ng.htm 


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



Re: [PHP] HTML in emails

2010-07-04 Thread Rick Pasotto
On Sun, Jul 04, 2010 at 06:31:38PM +0200, Per Jessen wrote:
 Al wrote:
 
  I know this is a bit off-topic; but close enough.
  
  I'm starting to update the email feature of one of my DB applications
  and noticed that it appears most of the fancy emails I receive are
  using just plain old, simple html pages, with a note about not being
  able to see, go here with a link.

Such emails are stupid. Obviously I can read the email quite fine. The
problem is that there is no useful content. Just an instruction to click
on a link.

  It use to be that we specified content-type text/html, etc. and sent
  both the plain ASCII and the html with boundaries and so forth.
 
 Yes, multipart/alternative that was. 
 
  Seems like, from my preliminary Google searching, I should not waste
  time with the standard's way and just go straight to sending simple
  html pages since all modern browsers handle it well. 
  And, it appears to be the way web is going.

Then I will never read your email.

Browsers are for web pages, not email.

  What are you folks doing?
 
 We follow the standard and send both text and html. 

The text portion is the *only* portion I read.

-- 
When dealing with people, remember you are not dealing with creatures
 of logic, but creatures of emotion. -- Dale Carnegie
Rick Pasottor...@niof.nethttp://www.niof.net

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



[PHP] form validation and error display

2010-07-04 Thread David Mehler
Hello,
I've got a form with several required fields of different types. I
want to have the php script process it only when all the required
fields are present, and to redisplay the form with filled in values on
failure so the user won't have to fill out the whole thing again.
One of my required fields is a text input field called name. If it's
not filled out the form displayed will show this:

input type=text name=name id=name size=50 value=?php
echo($name); ? / br /

Note, I've got $_POST* variable processing before this so am assigning
that processing to short variables.
If that field is filled out, but another required one is not that form
field will fill in the value entered for the name field.
This is working for my text input fields, but not for either select
boxes or textareas. Here's the textarea also a required field:

textarea name=description id=description cols=50 rows=10
value=?php echo($description); ?/textarea

What this does, if a user fills out this field, but misses another, it
should echo the value of what was originally submitted. It is not
doing this. Same for my select boxes, here's one:

select name=type id=type value=?php echo($type); ?
option value=0 selected=selected-- select type --/option
option value=meeting - Meeting - /option
option value=event - Event - /option
/select

I'd also like for any not entered required fields to have an error box
around them, I've got a css class to handle this, but am not sure how
to tie it in to the fields since any one of the required fields could
not be filled in.
I'd appreciate any help.
Thanks.
Dave.

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



Re: [PHP] HTML in emails

2010-07-04 Thread Per Jessen
Rick Pasotto wrote:

 On Sun, Jul 04, 2010 at 06:31:38PM +0200, Per Jessen wrote:
 
 We follow the standard and send both text and html.
 
 The text portion is the *only* portion I read.
 

Cool, that is the whole point. 


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


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



[PHP] curl

2010-07-04 Thread madunix
I have an old unix fedora system with php 4.3.11, with the following
recompiled options

$ php -version
 PHP 4.3.11 (cli) (built: Jun  6 2006 16:20:00)
Copyright (c) 1997-2004 The PHP Group
Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies


$ php -info | grep configure
Configure Command =  './configure' '--enable-discard-path'
'--enable-track-vars' '--enable-force-cgi-redirect' '--with-gettext'
'--with-mysql' '--enable-so' '--with-apxs2' '--with-gd' '--with-zlib'
'--with-jpeg-dir=/usr/lib' '--enable-libgcc'

am planning to add the curl option to it, what would be the best
approach for that.
stop http, configure with--curl, make, make install feedback appreciated.

Thanks

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



Re: [PHP] curl

2010-07-04 Thread shiplu
# yum install php4-curl
or
# yum install php-curl



Shiplu Mokadd.im
My talks, http://talk.cmyweb.net
Follow me, http://twitter.com/shiplu
SUST Programmers, http://groups.google.com/group/p2psust
Innovation distinguishes bet ... ... (ask Steve Jobs the rest)

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



Re: [PHP] HTML in emails

2010-07-04 Thread Paul M Foster
On Sun, Jul 04, 2010 at 11:43:59AM -0400, Al wrote:

 I know this is a bit off-topic; but close enough.

 I'm starting to update the email feature of one of my DB applications and
 noticed that it appears most of the fancy emails I receive are using
 just plain
 old, simple html pages, with a note about not being able to see, go here
 with a
 link.

 It use to be that we specified content-type text/html, etc. and sent both the
 plain ASCII and the html with boundaries and so forth.

 Seems like, from my preliminary Google searching, I should not waste
 time with
 the standard's way and just go straight to sending simple html pages
 since all
 modern browsers handle it well. And, it appears to be the way web is going.

 What are you folks doing?

I use mutt for email, so I only see the text portion. That make me an
anomaly. However, for example there are various listserv software that
will not allow HTML in emails.

Here is the real problem with HTML email. Any straight text message will
swell to many times its size when you HTML-ize it. Okay, so now you're
sending the message around the internet to perhaps hundreds or thousands
of users, using up many times the bandwidth that the actual message
really needs. It's like installing a 100w light bulb when a 60w will do.
There's simply no reason to suck CPU cycles all over the internet just
to make your message prettier.

I understand that the functions of email and browser seem to be merging.
However, this is what I would consider a bad trend. It stems from folks
like Microsoft who have convinced people, for example, that spreadsheets
function perfectly well as databases. They don't, but that doesn't stop
people from using Excel to keep their mailing lists.

Of course, opinions like mine won't stop the merging of browsing and
reading email. Ah well.

Paul

-- 
Paul M. Foster

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



Re: [PHP] form validation and error display

2010-07-04 Thread Shreyas Agasthya
David,

If I understand your problem/issue here, you are talking about something
called 'sticky forms'.
This means -
(i) the form references itself.
(ii) that the form knows what the previous data was when it encounters any
validation issues.

You achieve (i) and (ii) by re-submitting the form with the usage of a
superglobal variable called $_SERVER['PHP_SELF'].

form method='POST' action =php echo $_SERVER['PHP_SELF'] ? 

Regards,
Shreyas


On Sun, Jul 4, 2010 at 11:27 PM, David Mehler dave.meh...@gmail.com wrote:

 Hello,
 I've got a form with several required fields of different types. I
 want to have the php script process it only when all the required
 fields are present, and to redisplay the form with filled in values on
 failure so the user won't have to fill out the whole thing again.
 One of my required fields is a text input field called name. If it's
 not filled out the form displayed will show this:

 input type=text name=name id=name size=50 value=?php
 echo($name); ? / br /

 Note, I've got $_POST* variable processing before this so am assigning
 that processing to short variables.
 If that field is filled out, but another required one is not that form
 field will fill in the value entered for the name field.
 This is working for my text input fields, but not for either select
 boxes or textareas. Here's the textarea also a required field:

 textarea name=description id=description cols=50 rows=10
 value=?php echo($description); ?/textarea

 What this does, if a user fills out this field, but misses another, it
 should echo the value of what was originally submitted. It is not
 doing this. Same for my select boxes, here's one:

 select name=type id=type value=?php echo($type); ?
 option value=0 selected=selected-- select type --/option
 option value=meeting - Meeting - /option
 option value=event - Event - /option
 /select

 I'd also like for any not entered required fields to have an error box
 around them, I've got a css class to handle this, but am not sure how
 to tie it in to the fields since any one of the required fields could
 not be filled in.
 I'd appreciate any help.
 Thanks.
 Dave.

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




-- 
Regards,
Shreyas Agasthya


Re: [PHP] form validation and error display

2010-07-04 Thread Paul M Foster
On Sun, Jul 04, 2010 at 01:57:01PM -0400, David Mehler wrote:

 Hello,
 I've got a form with several required fields of different types. I
 want to have the php script process it only when all the required
 fields are present, and to redisplay the form with filled in values on
 failure so the user won't have to fill out the whole thing again.
 One of my required fields is a text input field called name. If it's
 not filled out the form displayed will show this:
 
 input type=text name=name id=name size=50 value=?php
 echo($name); ? / br /
 
 Note, I've got $_POST* variable processing before this so am assigning
 that processing to short variables.
 If that field is filled out, but another required one is not that form
 field will fill in the value entered for the name field.
 This is working for my text input fields, but not for either select
 boxes or textareas. Here's the textarea also a required field:
 
 textarea name=description id=description cols=50 rows=10
 value=?php echo($description); ?/textarea

Textarea fields don't work this way. To display the prior value, you
have to do this:

textarea name=description?php echo $description; ?/textarea

 
 What this does, if a user fills out this field, but misses another, it
 should echo the value of what was originally submitted. It is not
 doing this. Same for my select boxes, here's one:
 
 select name=type id=type value=?php echo($type); ?
 option value=0 selected=selected-- select type --/option
 option value=meeting - Meeting - /option
 option value=event - Event - /option
 /select

The value attribute of a select field won't do this for you. You have
to actually set up each option with an either/or choice, like this:

option value=0 ?php if ($type == 'meeting') echo 'selected=selected';
? - Meeting - /option

Since doing this is pretty tedious, I use a function here instead:

function set_selected($fieldname, $value)
{
if ($_POST[$fieldname] == $value)
echo 'selected=selected';
}

And then

option value=meeting ?php set_selected('type', 'meeting');
?Meeting/option

HTH,

Paul

-- 
Paul M. Foster

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



Re: [PHP] form validation and error display

2010-07-04 Thread David Mehler
Hello everyone,
Thanks for your suggestions.
For my variable in the value area of the text input field I enter

value=?php echo $name; ?

Prior to this I assign the variable $name to:

$name = stripslashes($_POST['name']);

I hope this is correct.
Sticky forms sounds exactly what i'm looking for. I've changed my
action attribute to

?php echo $_SERVER['PHP_SELF']; ?

The first thing I do once the page is loaded is check whether or not
submit is set, if it is not I display the form, which is in a function
call. If submit is set I want to begtin validation, so i'm deciding to
merge my two files in to one, I like this better. My question is say
for example the name text field is not filled out but all the other
required fields are how do I get the form to redisplay itself? I was
thinking a location redirect, but this doesn't sound right.
Thanks.
Dave.


On 7/4/10, Paul M Foster pa...@quillandmouse.com wrote:
 On Sun, Jul 04, 2010 at 01:57:01PM -0400, David Mehler wrote:

 Hello,
 I've got a form with several required fields of different types. I
 want to have the php script process it only when all the required
 fields are present, and to redisplay the form with filled in values on
 failure so the user won't have to fill out the whole thing again.
 One of my required fields is a text input field called name. If it's
 not filled out the form displayed will show this:

 input type=text name=name id=name size=50 value=?php
 echo($name); ? / br /

 Note, I've got $_POST* variable processing before this so am assigning
 that processing to short variables.
 If that field is filled out, but another required one is not that form
 field will fill in the value entered for the name field.
 This is working for my text input fields, but not for either select
 boxes or textareas. Here's the textarea also a required field:

 textarea name=description id=description cols=50 rows=10
 value=?php echo($description); ?/textarea

 Textarea fields don't work this way. To display the prior value, you
 have to do this:

 textarea name=description?php echo $description; ?/textarea


 What this does, if a user fills out this field, but misses another, it
 should echo the value of what was originally submitted. It is not
 doing this. Same for my select boxes, here's one:

 select name=type id=type value=?php echo($type); ?
 option value=0 selected=selected-- select type --/option
 option value=meeting - Meeting - /option
 option value=event - Event - /option
 /select

 The value attribute of a select field won't do this for you. You have
 to actually set up each option with an either/or choice, like this:

 option value=0 ?php if ($type == 'meeting') echo 'selected=selected';
 ? - Meeting - /option

 Since doing this is pretty tedious, I use a function here instead:

 function set_selected($fieldname, $value)
 {
   if ($_POST[$fieldname] == $value)
   echo 'selected=selected';
 }

 And then

 option value=meeting ?php set_selected('type', 'meeting');
 ?Meeting/option

 HTH,

 Paul

 --
 Paul M. Foster

 --
 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] HTML in emails

2010-07-04 Thread Ashley Sheridan
On Sun, 2010-07-04 at 17:06 -0400, Paul M Foster wrote:

 On Sun, Jul 04, 2010 at 11:43:59AM -0400, Al wrote:
 
  I know this is a bit off-topic; but close enough.
 
  I'm starting to update the email feature of one of my DB applications and
  noticed that it appears most of the fancy emails I receive are using
  just plain
  old, simple html pages, with a note about not being able to see, go here
  with a
  link.
 
  It use to be that we specified content-type text/html, etc. and sent both 
  the
  plain ASCII and the html with boundaries and so forth.
 
  Seems like, from my preliminary Google searching, I should not waste
  time with
  the standard's way and just go straight to sending simple html pages
  since all
  modern browsers handle it well. And, it appears to be the way web is going.
 
  What are you folks doing?
 
 I use mutt for email, so I only see the text portion. That make me an
 anomaly. However, for example there are various listserv software that
 will not allow HTML in emails.
 
 Here is the real problem with HTML email. Any straight text message will
 swell to many times its size when you HTML-ize it. Okay, so now you're
 sending the message around the internet to perhaps hundreds or thousands
 of users, using up many times the bandwidth that the actual message
 really needs. It's like installing a 100w light bulb when a 60w will do.
 There's simply no reason to suck CPU cycles all over the internet just
 to make your message prettier.
 
 I understand that the functions of email and browser seem to be merging.
 However, this is what I would consider a bad trend. It stems from folks
 like Microsoft who have convinced people, for example, that spreadsheets
 function perfectly well as databases. They don't, but that doesn't stop
 people from using Excel to keep their mailing lists.
 
 Of course, opinions like mine won't stop the merging of browsing and
 reading email. Ah well.
 
 Paul
 
 -- 
 Paul M. Foster
 


I agree. Obviously the proliferation of free webmail accounts like Live,
GMail, Yahoo, etc have had a large impact on the way people consider
email. I actually had a friend ask me what this POP3 email thing was,
and what made it different from normal email, and it took me a moment to
realise his understanding of normal was one of these webmail services
available through the browser!

It is nice to be able to format emails nicely, but you have to realise
when to restrain yourself. I've been getting loads of emails from Adobe
lately that haven't been formatted well at all, and appear awfully in my
email client (Evolution, which I consider to be a very good client)
until I download all the images they've used as backgrounds. It's
situations like this that give HTML emails an awful name.

One feature I've seen in some mailing list software is the ability to
track how people prefer their email formatted, so that you only send
HTML emails to those that want them, and text emails to those who prefer
that method. It's the best of both worlds I reckon, and one that is
likely to upset as few people as possible; at the worst they might
receive one email in a format they don't want before they change their
preferences.

Thanks,
Ash
http://www.ashleysheridan.co.uk




Re: [PHP] form validation and error display

2010-07-04 Thread Ashley Sheridan
On Sun, 2010-07-04 at 18:23 -0400, David Mehler wrote:

 Hello everyone,
 Thanks for your suggestions.
 For my variable in the value area of the text input field I enter
 
 value=?php echo $name; ?
 
 Prior to this I assign the variable $name to:
 
 $name = stripslashes($_POST['name']);
 
 I hope this is correct.
 Sticky forms sounds exactly what i'm looking for. I've changed my
 action attribute to
 
 ?php echo $_SERVER['PHP_SELF']; ?
 
 The first thing I do once the page is loaded is check whether or not
 submit is set, if it is not I display the form, which is in a function
 call. If submit is set I want to begtin validation, so i'm deciding to
 merge my two files in to one, I like this better. My question is say
 for example the name text field is not filled out but all the other
 required fields are how do I get the form to redisplay itself? I was
 thinking a location redirect, but this doesn't sound right.
 Thanks.
 Dave.
 
 
 On 7/4/10, Paul M Foster pa...@quillandmouse.com wrote:
  On Sun, Jul 04, 2010 at 01:57:01PM -0400, David Mehler wrote:
 
  Hello,
  I've got a form with several required fields of different types. I
  want to have the php script process it only when all the required
  fields are present, and to redisplay the form with filled in values on
  failure so the user won't have to fill out the whole thing again.
  One of my required fields is a text input field called name. If it's
  not filled out the form displayed will show this:
 
  input type=text name=name id=name size=50 value=?php
  echo($name); ? / br /
 
  Note, I've got $_POST* variable processing before this so am assigning
  that processing to short variables.
  If that field is filled out, but another required one is not that form
  field will fill in the value entered for the name field.
  This is working for my text input fields, but not for either select
  boxes or textareas. Here's the textarea also a required field:
 
  textarea name=description id=description cols=50 rows=10
  value=?php echo($description); ?/textarea
 
  Textarea fields don't work this way. To display the prior value, you
  have to do this:
 
  textarea name=description?php echo $description; ?/textarea
 
 
  What this does, if a user fills out this field, but misses another, it
  should echo the value of what was originally submitted. It is not
  doing this. Same for my select boxes, here's one:
 
  select name=type id=type value=?php echo($type); ?
  option value=0 selected=selected-- select type --/option
  option value=meeting - Meeting - /option
  option value=event - Event - /option
  /select
 
  The value attribute of a select field won't do this for you. You have
  to actually set up each option with an either/or choice, like this:
 
  option value=0 ?php if ($type == 'meeting') echo 'selected=selected';
  ? - Meeting - /option
 
  Since doing this is pretty tedious, I use a function here instead:
 
  function set_selected($fieldname, $value)
  {
  if ($_POST[$fieldname] == $value)
  echo 'selected=selected';
  }
 
  And then
 
  option value=meeting ?php set_selected('type', 'meeting');
  ?Meeting/option
 
  HTH,
 
  Paul
 
  --
  Paul M. Foster
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 


$_SERVER['PHP_SELF'] is not to be trusted, and shouldn't be used as the
action of a form like this.
http://www.mc2design.com/blog/php_self-safe-alternatives explains it all
better than I can here, so it's worth a read, but it does list safe
alternatives.

One thing I do when creating sticky select lists is this:

$colours = array('red', 'green', 'blue', 'yellow', 'pink');

echo 'select name=colour';
for($i=0; $icount($colours); $i++)
{
$selected = (isset($_POST['colour'])  $_POST['colour'] ==
$i)?'selected=selected':'';
echo option value=\$i\ $selected{$colours[$i]}/option;
}
echo '/select';

Basically, this uses PHP to not only output the list from an array
(which itself can be populated from a database maybe) and select the
right option if it exists in the $_POST array and matches the current
option in the loop that's being output.

Thanks,
Ash
http://www.ashleysheridan.co.uk




Re: [PHP] HTML in emails

2010-07-04 Thread Paul M Foster
On Sun, Jul 04, 2010 at 11:44:29PM +0100, Ashley Sheridan wrote:


snip

 
It is nice to be able to format emails nicely, but you have to realise
when to restrain yourself. I've been getting loads of emails from Adobe
lately that haven't been formatted well at all, and appear awfully in my
email client (Evolution, which I consider to be a very good client) until
I download all the images they've used as backgrounds. It's situations
like this that give HTML emails an awful name.

Isn't this a popular exploit these days? I don't really watch these
things since I use Linux and view mail as straight text. But isn't there
some current exploit where images which can be downloaded as part of an
email actually contain code which can be used to sniff your system or
somesuch?

Paul

-- 
Paul M. Foster

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