Re: PHP Send mail problems.

Discussion in 'HTML' started by rf, Aug 2, 2010.

  1. rf

    rf Guest

    <> wrote in message
    news:...
    >I have designed a site in Expression Web (yes I know you all hate it)
    > and it has some forms in it which work fine in IE but not in Chrome
    > and Firefox (surprise, surprise) but I can't work out the problem.


    Define "which work fine in IE but not in Chrome and Firefox".

    What exactly does not work in Chrome and Firefox. What error messages. What
    happens that you don't expect. What does not happen that you do expect. We
    are not mind readers.

    <snip code>
     
    rf, Aug 2, 2010
    #1
    1. Advertising

  2. rf

    Doug Miller Guest

    In article <>, "" <> wrote:
    >On Mon, 2 Aug 2010 22:46:01 +1000, "rf" <> wrote:
    >
    >>
    >><> wrote in message
    >>news:...
    >>>I have designed a site in Expression Web (yes I know you all hate it)
    >>> and it has some forms in it which work fine in IE but not in Chrome
    >>> and Firefox (surprise, surprise) but I can't work out the problem.

    >>
    >>Define "which work fine in IE but not in Chrome and Firefox".
    >>
    >>What exactly does not work in Chrome and Firefox. What error messages. What
    >>happens that you don't expect. What does not happen that you do expect. We
    >>are not mind readers.
    >>
    >><snip code>
    >>

    >What happens is absolutely nothing. I click on send and nothing
    >happens.


    Nothing _at all_? Do you mean that the PHP script that is the form action is
    never invoked?
     
    Doug Miller, Aug 2, 2010
    #2
    1. Advertising

  3. ing wrote:
    > What happens is absolutely nothing. I click on send and nothing
    > happens. If you folllowed the link and tried, why would you need to
    > read minds?


    "The page address is www.1stce.co.uk/DJ_from.htm"

    404 Not Found

    --
    Take care,

    Jonathan
    -------------------
    LITTLE WORKS STUDIO
    http://www.LittleWorksStudio.com
     
    Jonathan N. Little, Aug 2, 2010
    #3
  4. ing wrote:
    > On Mon, 2 Aug 2010 16:13:27 +0200, "MG"<> wrote:
    >
    >>> happens. If you folllowed the link and tried, why would you need to
    >>> read minds?

    >>
    >> I tried to follow the link, but I got a Error 404 Not Found.
    >>
    >> MG
    >>

    > Try this one
    >
    > http://www.1stce.co.uk/DJ_form.htm
    >
    > copied and pasted straight from my browser.


    It "worked", but:

    1) META tags redirects are not dependable and can be block by a browser
    setting and security software:

    <http://www.google.com/search?q=meta+tag+refresh+bad+way+to+redirect>

    2) You meta tag is invalid to boot. IIRC the delay must be >0

    3) You are using PHP do the redirect via the headers, it is totlay
    invisible to the browser.

    4) Your form has really no validation for the data inputted. Checking
    for non-empty files is not really validation and dying is not really a
    good error handler.

    Web Expressions is not really of much help to you in these areas.

    --
    Take care,

    Jonathan
    -------------------
    LITTLE WORKS STUDIO
    http://www.LittleWorksStudio.com
     
    Jonathan N. Little, Aug 2, 2010
    #4
  5. rf

    Doug Miller Guest

    In article <>, "" <> wrote:
    >On Mon, 02 Aug 2010 14:05:05 GMT, (Doug Miller)
    >wrote:
    >
    >>In article <>, ""

    > <> wrote:
    >>>On Mon, 2 Aug 2010 22:46:01 +1000, "rf" <> wrote:
    >>>
    >>>>
    >>>><> wrote in message
    >>>>news:...
    >>>>>I have designed a site in Expression Web (yes I know you all hate it)
    >>>>> and it has some forms in it which work fine in IE but not in Chrome
    >>>>> and Firefox (surprise, surprise) but I can't work out the problem.
    >>>>
    >>>>Define "which work fine in IE but not in Chrome and Firefox".
    >>>>
    >>>>What exactly does not work in Chrome and Firefox. What error messages. What
    >>>>happens that you don't expect. What does not happen that you do expect. We
    >>>>are not mind readers.
    >>>>
    >>>><snip code>
    >>>>
    >>>What happens is absolutely nothing. I click on send and nothing
    >>>happens.

    >>
    >>Nothing _at all_? Do you mean that the PHP script that is the form action is
    >>never invoked?

    >
    >Probably not. Nothing apears to happen. No email arrives.


    "Probably not"???

    Does it not occur to you that you need to know *definitely* whether it is or
    is not invoked?
     
    Doug Miller, Aug 2, 2010
    #5
  6. rf

    Doug Miller Guest

    In article <>, "" <> wrote:
    >
    >>>>never invoked?
    >>>
    >>>Probably not. Nothing apears to happen. No email arrives.

    >>
    >>"Probably not"???
    >>
    >>Does it not occur to you that you need to know *definitely* whether it is or
    >>is not invoked?

    >
    >Well if I knew things like that I wouldn't need to ask you nice people
    >questions about it now would i? ;-)


    I can't answer that. But I also can't give you any meaningful help until
    you're able to determine whether the script is, or is not, invoked.
     
    Doug Miller, Aug 2, 2010
    #6
  7. ing wrote:

    > Nothing relevant in the logs I've found. I haven't found a specific
    > PHP log. I have asked my host's support perople about it though.


    Unless otherwise configured PHP errors are logging in the webserver's
    log, i.e., Apache's log.

    --
    Take care,

    Jonathan
    -------------------
    LITTLE WORKS STUDIO
    http://www.LittleWorksStudio.com
     
    Jonathan N. Little, Aug 2, 2010
    #7
  8. ing wrote:

    > The only logs I can find have no PHPH errors at all which leads me
    > back to the earlier suggestion that the script is never geting called?


    Possibly, but not absolutely. Error logging may be off. Some hosting
    turn it off by default to prevent revealing information about your
    script when an error occurs.

    Very bad and risky to have announced on your webpage:

    PHP ERROR: /var/www/mysite/keymaster.php line: 23
    '/var/www/mysite/private/keys2kingdom' not found or unable to stat


    --
    Take care,

    Jonathan
    -------------------
    LITTLE WORKS STUDIO
    http://www.LittleWorksStudio.com
     
    Jonathan N. Little, Aug 2, 2010
    #8
  9. rf

    Peter Guest

    In article <>,
    ing says...
    > On Mon, 02 Aug 2010 14:05:05 GMT, (Doug Miller)
    > wrote:
    >
    > >In article <>, "" <> wrote:
    > >>On Mon, 2 Aug 2010 22:46:01 +1000, "rf" <> wrote:
    > >>
    > >>>
    > >>><> wrote in message
    > >>>news:...
    > >>>>I have designed a site in Expression Web (yes I know you all hate it)
    > >>>> and it has some forms in it which work fine in IE but not in Chrome
    > >>>> and Firefox (surprise, surprise) but I can't work out the problem.
    > >>>
    > >>>Define "which work fine in IE but not in Chrome and Firefox".
    > >>>
    > >>>What exactly does not work in Chrome and Firefox. What error messages. What
    > >>>happens that you don't expect. What does not happen that you do expect. We
    > >>>are not mind readers.
    > >>>
    > >>><snip code>
    > >>>
    > >>What happens is absolutely nothing. I click on send and nothing
    > >>happens.

    > >
    > >Nothing _at all_? Do you mean that the PHP script that is the form action is
    > >never invoked?

    >
    > Probably not. Nothing apears to happen. No email arrives.
    >


    It does invoke the script. However what happens after that is anyone's
    guess as we can't see your php. If you leave all fields blank with
    Chrome you get the error message, 'text field is empty', which is
    generated by send_dj.php.

    --
    Pete Ives
    Remove All_stRESS before sending me an email
     
    Peter, Aug 3, 2010
    #9
  10. rf

    Doug Miller Guest

    In article <>, "" <> wrote:
    >
    >>> >
    >>> >Nothing _at all_? Do you mean that the PHP script that is the form action

    > is
    >>> >never invoked?
    >>>
    >>> Probably not. Nothing apears to happen. No email arrives.
    >>>

    >>
    >>It does invoke the script. However what happens after that is anyone's
    >>guess as we can't see your php. If you leave all fields blank with
    >>Chrome you get the error message, 'text field is empty', which is
    >>generated by send_dj.php.

    >
    >
    >I didn't get ANY error message.


    Then turn error reporting on, either in php.ini or in the script itself, so
    you can see what's going wrong. Put some echo commands into the script at
    various points so you can verify its progress.
     
    Doug Miller, Aug 3, 2010
    #10
  11. rf

    Doug Miller Guest

    In article <>, "" <> wrote:
    >On Tue, 03 Aug 2010 13:42:57 GMT, (Doug Miller)
    >wrote:
    >
    >>In article <>, ""

    > <> wrote:
    >>>
    >>>>> >
    >>>>> >Nothing _at all_? Do you mean that the PHP script that is the form action
    >>> is
    >>>>> >never invoked?
    >>>>>
    >>>>> Probably not. Nothing apears to happen. No email arrives.
    >>>>>
    >>>>
    >>>>It does invoke the script. However what happens after that is anyone's
    >>>>guess as we can't see your php. If you leave all fields blank with
    >>>>Chrome you get the error message, 'text field is empty', which is
    >>>>generated by send_dj.php.
    >>>
    >>>
    >>>I didn't get ANY error message.

    >>
    >>Then turn error reporting on, either in php.ini or in the script itself, so
    >>you can see what's going wrong. Put some echo commands into the script at
    >>various points so you can verify its progress.

    >
    >How do I turn on error reporting in the script?


    http://lmgtfy.com/?q=turn on error reporting in php

    >And when you say an
    >echo command, you mean it would put a message on screen? TIA.


    Yes, of course. Alternatively, you could write to the error log.
     
    Doug Miller, Aug 3, 2010
    #11
  12. ing wrote:
    >
    >>>>
    >>>> Nothing _at all_? Do you mean that the PHP script that is the form action is
    >>>> never invoked?
    >>>
    >>> Probably not. Nothing apears to happen. No email arrives.
    >>>

    >>
    >> It does invoke the script. However what happens after that is anyone's
    >> guess as we can't see your php. If you leave all fields blank with
    >> Chrome you get the error message, 'text field is empty', which is
    >> generated by send_dj.php.


    That is because the only error handling the OP is doing is making the
    script die. I listed what he needed to do in post:

    <http://groups.google.com/group/alt.html/msg/e88015a2452e2288>


    >
    >
    > I didn't get ANY error message. And my PHP script was in the original
    > posting. I have duplicated below. Thanks.
    >
    > <?php
    > //--------------------------Set these
    > paramaters--------------------------
    >
    > // Subject of email sent to you.
    > $subject = 'DJ';
    >
    > // Your email address. This is where the form information will be
    > sent.
    > $emailadd = '';
    >
    > // Where to redirect after form is processed.
    > $url = 'Thank you.htm';
    >
    > // Makes all fields required. If set to '1' no field can not be empty.
    > If set to '0' any or all fields can be empty.
    > $req = '1';
    >
    > // --------------------------Do not edit below this
    > line--------------------------
    > $text = "Results from form:\n\n";
    > $space = ' ';
    > $line = '
    > ';
    > foreach ($_POST as $key => $value)
    > {
    > if ($req == '1')
    > {
    > if ($value == '')
    > {echo "$key is empty";die;}


    This is NOT effective error handling in a production script.

    > }
    > $j = strlen($key);
    > if ($j>= 20)
    > {echo "Name of form element $key cannot be longer than 20
    > characters";die;}
    > $j = 20 - $j;
    > for ($i = 1; $i<= $j; $i++)
    > {$space .= ' ';}
    > $value = str_replace('\n', "$line", $value);
    > $conc = "{$key}:$space{$value}$line";
    > $text .= $conc;
    > $space = ' ';
    > }
    > mail($emailadd, $subject, $text, 'From: '.$emailadd.'');
    > echo '<META HTTP-EQUIV=Refresh CONTENT="0; URL='.$url.'">';
    > ?>
    >
    > The last line has since been replaced as per Jonathon's suggestion.


    Then why are you show that meta tag hack instead of the header command
    that I showed you?

    header("Location: $url");

    --
    Take care,

    Jonathan
    -------------------
    LITTLE WORKS STUDIO
    http://www.LittleWorksStudio.com
     
    Jonathan N. Little, Aug 3, 2010
    #12
  13. ing wrote:
    > On Tue, 03 Aug 2010 13:42:57 GMT, (Doug Miller)
    > wrote:
    >
    >> In article<>, ""<> wrote:


    <snip>

    >>>
    >>> I didn't get ANY error message.

    >>
    >> Then turn error reporting on, either in php.ini or in the script itself, so
    >> you can see what's going wrong. Put some echo commands into the script at
    >> various points so you can verify its progress.

    >
    > How do I turn on error reporting in the script? And when you say an
    > echo command, you mean it would put a message on screen? TIA.


    Again I posted complete references on how to do this?

    <http://groups.google.com/group/alt.html/msg/35770c5805905fe9>

    Did you not read any of this?

    --
    Take care,

    Jonathan
    -------------------
    LITTLE WORKS STUDIO
    http://www.LittleWorksStudio.com
     
    Jonathan N. Little, Aug 3, 2010
    #13
  14. rf

    Peter Guest

    In article <>,
    ing says...
    >
    > >> >
    > >> >Nothing _at all_? Do you mean that the PHP script that is the form action is
    > >> >never invoked?
    > >>
    > >> Probably not. Nothing apears to happen. No email arrives.
    > >>

    > >
    > >It does invoke the script. However what happens after that is anyone's
    > >guess as we can't see your php. If you leave all fields blank with
    > >Chrome you get the error message, 'text field is empty', which is
    > >generated by send_dj.php.

    >
    >
    > I didn't get ANY error message. And my PHP script was in the original
    > posting. I have duplicated below. Thanks.
    >
    > <?php
    > //--------------------------Set these
    > paramaters--------------------------
    >
    > // Subject of email sent to you.
    > $subject = 'DJ';
    >
    > // Your email address. This is where the form information will be
    > sent.
    > $emailadd = '';
    >
    > // Where to redirect after form is processed.
    > $url = 'Thank you.htm';
    >
    > // Makes all fields required. If set to '1' no field can not be empty.
    > If set to '0' any or all fields can be empty.
    > $req = '1';
    >
    > // --------------------------Do not edit below this
    > line--------------------------
    > $text = "Results from form:\n\n";
    > $space = ' ';
    > $line = '
    > ';
    > foreach ($_POST as $key => $value)
    > {
    > if ($req == '1')
    > {
    > if ($value == '')
    > {echo "$key is empty";die;}
    > }
    > $j = strlen($key);
    > if ($j >= 20)
    > {echo "Name of form element $key cannot be longer than 20
    > characters";die;}
    > $j = 20 - $j;
    > for ($i = 1; $i <= $j; $i++)
    > {$space .= ' ';}
    > $value = str_replace('\n', "$line", $value);
    > $conc = "{$key}:$space{$value}$line";
    > $text .= $conc;
    > $space = ' ';
    > }
    > mail($emailadd, $subject, $text, 'From: '.$emailadd.'');


    Personally I would change that header part of the mail to

    $headers = 'From: '.$emailadd;

    mail($emailadd, $subject, $text, $headers);

    > echo '<META HTTP-EQUIV=Refresh CONTENT="0; URL='.$url.'">';
    > ?>
    >
    > The last line has since been replaced as per Jonathon's suggestion.
    >


    --
    Pete Ives
    Remove All_stRESS before sending me an email
     
    Peter, Aug 4, 2010
    #14
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Nathan Sokalski
    Replies:
    3
    Views:
    1,960
    Larry Lard
    Nov 23, 2005
  2. =?Utf-8?B?Unlhbg==?=
    Replies:
    2
    Views:
    3,925
    Steven Cheng[MSFT]
    Feb 28, 2006
  3. Rajive Narain
    Replies:
    0
    Views:
    1,990
    Rajive Narain
    Sep 18, 2009
  4. Jonathan N. Little

    Re: HELP: PHP Send mail problems.

    Jonathan N. Little, Aug 2, 2010, in forum: HTML
    Replies:
    2
    Views:
    605
    Doug Miller
    Aug 2, 2010
  5. Doug Miller

    Re: HELP: PHP Send mail problems.

    Doug Miller, Aug 2, 2010, in forum: HTML
    Replies:
    9
    Views:
    516
    Raymond Schmit
    Aug 4, 2010
Loading...

Share This Page