Professional Web Applications Themes

basic help needed.. - PHP Development

Hi, I made a bunch of forms in dreamweaver, and created a basic php script to process the form and email me the results. So far so good, here is the script: <? $Name=$_POST['Name']; $Email=$_POST['Email']; $Comments=$_POST['Message']; $to="com"; $message="$Name just filled in your contact form. Message was:\n$Message\n\nTheir E-Mail address was: $Email"; if(mail($to,"Comments From Your Site",$message,"From: $Email\n")) { echo "Your message was delivered successfully. Please use the back button of your browser to return to Webhost."; } else { echo "There was a problem sending the mail. Please check that you filled in the form correctly."; } ?> It works fine, it ...

  1. #1

    Default basic help needed..

    Hi, I made a bunch of forms in dreamweaver, and created a basic php
    script to process the form and email me the results. So far so good,
    here is the script:

    <?
    $Name=$_POST['Name'];
    $Email=$_POST['Email'];
    $Comments=$_POST['Message'];
    $to="com";
    $message="$Name just filled in your contact form. Message
    was:\n$Message\n\nTheir E-Mail address was: $Email";
    if(mail($to,"Comments From Your Site",$message,"From: $Email\n")) {
    echo "Your message was delivered successfully. Please use the back
    button of your browser to return to Webhost.";
    } else {
    echo "There was a problem sending the mail. Please check that you filled
    in the form correctly.";
    }
    ?>

    It works fine, it send a message to my email (i changed the email in the
    script, the one thats showing is just a generic email).

    However, I don't like the fact that when the submit button is pushed,
    and the form is executed successfully, the only thing it does is take
    the user to a blank white page with the echo message above:

    "Your message was delivered successfully. Please use the back button of
    your browser to return to Webhost."

    I really don't want the user to have to push the back button, and on top
    of that to be taken back to the same form page which is all filled in.

    Here is what I would like to add to this script if it is possible:

    A. Instead of the echo message above, just something simple like:
    "Click <here> to return to "webhost"", where <here> is a link of my
    choosing.

    but even better would be

    B. A redirection to a html page. For example, when the user completes
    the form, I'd like them to be taken to a success.html page if
    successful, or error.html if not.

    Is there anyway to do this simply in the same above script to replace
    the echo messages? Option B is what I really want, although I'll settle
    for A if the above requires advanced programming.

    Thank you very much.

    --
    Regards from Trypt!
    trypt2000(remove)
    Trypt Guest

  2. #2

    Default Re: basic help needed..

    I noticed that Message-ID: <com> from
    Trypt contained the following:
     

    Make sure that this is the only thing on this page. Then do:

    <?
    $Name=$_POST['Name'];
    $Email=$_POST['Email'];
    $Comments=$_POST['Message'];
    $to="com";
    $message="$Name just filled in your contact form. Message
    was:\n$Message\n\nTheir E-Mail address was: $Email";
    if(mail($to,"Comments From Your Site",$message,"From: $Email\n")) {
    header("Location: success.html");
    } else {
    header("Location: error.html");
    }
    ?>

    (assuming these pages are in the same directory. To be safe, use the
    full URL)

    --
    Geoff Berrow 0110001001101100010000000110
    001101101011011001000110111101100111001011
    100110001101101111001011100111010101101011
    Geoff Guest

  3. #3

    Default Re: basic help needed..

    Geoff Berrow wrote: 
    >
    >
    > Make sure that this is the only thing on this page. Then do:
    >
    > <?
    > $Name=$_POST['Name'];
    > $Email=$_POST['Email'];
    > $Comments=$_POST['Message'];
    > $to="com";
    > $message="$Name just filled in your contact form. Message
    > was:\n$Message\n\nTheir E-Mail address was: $Email";
    > if(mail($to,"Comments From Your Site",$message,"From: $Email\n")) {
    > header("Location: success.html");
    > } else {
    > header("Location: error.html");
    > }
    > ?>
    >
    > (assuming these pages are in the same directory. To be safe, use the
    > full URL)
    >[/ref]

    Wow, I can't believe it was that easy!! Thanx a lot, it works great!

    How about one more piece of help from you? I am working on a site and
    using Dreamweaver. However, no matter what I do its not accessing my
    css sheet (style). I have no idea whats going on. I create a new style
    sheet, save the style file, everytihng is ok within dreamweaver, even
    when I preview. But when I upload everything onto the server, the html
    pages are not reading the css at all!

    --
    Regards from Trypt!
    trypt2000(remove)
    Trypt Guest

  4. #4

    Default Re: basic help needed..

    I noticed that Message-ID: <com> from
    Trypt contained the following:
     

    Stupid question, you are uploading the style sheet too?

    Check your .html (or.php) pages have a line which reads something like:
    <link rel="stylesheet" type="text/css
    "href="directory/nameofstylesheet.css">


    --
    Geoff Berrow 0110001001101100010000000110
    001101101011011001000110111101100111001011
    100110001101101111001011100111010101101011
    Geoff Guest

  5. #5

    Default Re: basic help needed..

    In this example where the email code is on the same page as the form,
    what should the "form action" be set to. Assuming that there is no
    need for another php page.

    Another way to ask the same question is, is it ok to leave the "form
    action" blank?

    Geoff Berrow:
    Geoff Berrow <co.uk> a écrit dans le message : 
    >
    >Make sure that this is the only thing on this page. Then do:
    >
    ><?
    >$Name=$_POST['Name'];
    >$Email=$_POST['Email'];
    >$Comments=$_POST['Message'];
    >$to="com";
    >$message="$Name just filled in your contact form. Message
    >was:\n$Message\n\nTheir E-Mail address was: $Email";
    >if(mail($to,"Comments From Your Site",$message,"From: $Email\n")) {
    >header("Location: success.html");
    >} else {
    >header("Location: error.html");
    >}
    >?>
    >
    >(assuming these pages are in the same directory. To be safe, use the
    >full URL)[/ref]

    Taxi Guest

  6. #6

    Default Re: basic help needed..

    I noticed that Message-ID: <com>
    from Taxi Driver contained the following:
     

    Yes, or use action="<?php echo $_SERVER['PHP_SELF']; ?>"

    But the other code must be at the top of the page, before any output.
    Clearly there will have to be some if(condition){} there to stop the
    script being run before the form is submitted.

    --
    Geoff Berrow 0110001001101100010000000110
    001101101011011001000110111101100111001011
    100110001101101111001011100111010101101011
    Geoff Guest

  7. #7

    Default Re: basic help needed..

    Geoff Berrow wrote: 
    >
    >
    > Stupid question, you are uploading the style sheet too?
    >
    > Check your .html (or.php) pages have a line which reads something like:
    > <link rel="stylesheet" type="text/css
    > "href="directory/nameofstylesheet.css">
    >
    >[/ref]

    I saved it in the cgi-bin directory while in dreamweaver and of course
    uploaded it. It did not work, so I tried to put it into the main
    directory, but same thing. Funny thing is that when I load my site, the
    only time the style sheet shows up in dreamweaver is when I open the
    actual page on which i used the sheet. Is there a way to make the sheet
    site wide while its already done?

    I even deleted it and made one from scratch, while the site was open in
    dreamweaver, but the same thing.

    --
    Regards from Trypt!
    trypt2000(remove)
    Trypt Guest

  8. #8

    Default Re: basic help needed..

    On Sun, 24 Jul 2005 14:42:53 -0400, Trypt wrote:
     
    >>
    >>
    >> Stupid question, you are uploading the style sheet too?
    >>
    >> Check your .html (or.php) pages have a line which reads something like:
    >> <link rel="stylesheet" type="text/css
    >> "href="directory/nameofstylesheet.css">
    >>
    >>[/ref]
    >
    > I saved it in the cgi-bin directory while in dreamweaver and of course
    > uploaded it. It did not work, so I tried to put it into the main
    > directory, but same thing. Funny thing is that when I load my site, the
    > only time the style sheet shows up in dreamweaver is when I open the
    > actual page on which i used the sheet. Is there a way to make the sheet
    > site wide while its already done?
    >
    > I even deleted it and made one from scratch, while the site was open in
    > dreamweaver, but the same thing.[/ref]

    As Geoff said chechk that you have the following line in ALL your html
    pages

    <link rel="STYLESHEET" href="Your_css_sheet_name_here.css" type="text/css"
    />

    And make sure that the sheet is in the same directory as your html pages.

    Or change the href path to where you have your css sheet located.

    If you still have trouble take a look at this page.
    http://www.htmlhelp.com/reference/css/style-html.html#external or
    http://www.w3schools.com/css/css_intro.asp
    Rincewind Guest

Similar Threads

  1. Basic Example Needed To Communicate With ASP.NET 2.0 Web Service
    By emartinez.gt@gmail.com in forum Macromedia Flex General Discussion
    Replies: 2
    Last Post: July 6th, 01:00 PM
  2. basic authentication by code -- help needed!!!
    By ami.turgman@gmail.com in forum ASP.NET Security
    Replies: 5
    Last Post: April 2nd, 11:08 PM
  3. simple examples needed with sql2000, asp.net, visual basic
    By Ryan McBride in forum ASP.NET Data Grid Control
    Replies: 5
    Last Post: December 14th, 01:05 PM
  4. Help needed with basic Perl math commands
    By \Dandy\ Randy in forum PERL Miscellaneous
    Replies: 4
    Last Post: July 27th, 05:11 AM
  5. Really basic help needed with mouse overs
    By w.robson.dslw@oneteldsl.net in forum Macromedia Flash
    Replies: 2
    Last Post: July 20th, 04:40 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139