33 users online (0 members and 33 guests)  


  Results 1 to 14 of 14

Related

  1. Please Help Me - CGI Mail Form    Forum: CGI Perl Forum
    Replies: 1
  2. Help, form mail    Forum: PHP Forum
    Replies: 0
  3. php mail script help    Forum: PHP Forum
    Replies: 14
  4. E-mail to a friend Form    Forum: HTML Forum
    Replies: 5
  1. #1
    Arcania's Avatar
    New User

    Status
    Offline
    Join Date
    Jul 2003
    Location
    Kentucky
    Posts
    7

    Forms within E-mail

    Here's what I'm trying to do. It may not be possible, but I seem to be close so I wanted to see if I was overlooking something. I have a form which submits an e-mail to me. Within this e-mail is another form with the same information, but allowing me, the webmaster to Accept or Deny the information.

    I would like to be able to use Accept and Deny buttons (previously the information was sent and I entered it manually if I accepted it) so that it would be a quicker process and I wouldn't be able to make mistakes retyping the input.

    The first part, the original form which send the e-mail works fine (members2.php). I get the e-mail with the embedded form, but the buttons don't work. Here's the html form within the e-mail (testemailapp.php):

    $body="<H2>Accept/Deny New Member</H2><form name=\"adddenyuser\" enctype=\"multipart/form-data\" method=\"post\" action=\"http://www.wku.edu/gg/users2.php\"><table><tr><td><FONT SIZE=\"4\">Account Information</FONT><br><table><tr><td>Real Name:</td><td> <input type=\"text\" name=\"name\" value=\"$name\";></td></tr><tr><td>User ID:</td><td> <input type=\"text\" name=\"userid\" value=\"$userid\";></td></tr><tr><td>Password:</td><td> <input type=\"password\" name=\"pass1\" value=\"$password\";></td></tr></table></td><td><FONT SIZE=\"4\">Member Details</FONT><br>Phone Number: <input type=\"text\" name=\"newphone\" value=\"$phone\";><br><input type=\"checkbox\" name=\"newphoneshow\" value=\"1\" $sphone>Show Phone Number on Members page<br>E-mail Address: <input type=\"text\" name=\"mail\" value=\"$email\";><br><input type=\"checkbox\" name=\"mailshow\" value=\"1\" $semail>Show E-mail Address on Members page<br><input type=\"checkbox\" name=\"memlev\" value=\"1\" $sofficer>Officer?<br></td></tr><tr><td><input type=\"submit\" name=\"Accept\" value=\"Accept\"></td><td><input type=\"submit\" name=\"Deny\" value=\"Deny\"></td></tr><tr>For record purposes, the password is: $password</tr></table>";

    mail("bowdemc@wku.edu", "Accept/Deny Web Membership", "$body");
    Once it sends, it goes to users2.php which has the following code:

    <?php
    if($remove)
    {
    remove($remuser);
    ?>
    <script language="javascript">
    location.replace("<?php echo $PHP_SELF; ?>");
    </script>

    <meta http-equiv="refresh" content="0; url=<?php echo $PHP_SELF; ?>">
    <?php
    }
    if($replace)
    {
    remove($userid);
    if($pass1 != $pass2)
    {
    echo "Re-enter password information and submit again";
    }
    else
    {
    $fp = fopen("/export/htdocs/Dept/Org/Student/wkugg/members/users.txt", "a");
    //$fp = fopen("users.txt", "a");
    fwrite($fp, "\n");
    fwrite($fp, $userid);
    fwrite($fp, ":");
    fwrite($fp, $pass1);
    fwrite($fp, ":");
    fwrite($fp, $name);
    fwrite($fp, ":");
    fwrite($fp, $mail);
    fwrite($fp, ":");
    if($mailshow)
    {
    fwrite($fp, "1");
    }
    else
    {
    fwrite($fp, "0");
    }
    fwrite($fp, ":");
    fwrite($fp, $newphone);
    fwrite($fp, ":");
    if($newphoneshow)
    {
    fwrite($fp, "1");
    }
    else
    {
    fwrite($fp, "0");
    }

    fwrite($fp, ":");
    if($memlev == 1)
    {
    fwrite($fp, "officer");
    }
    else
    {
    fwrite($fp, "member");
    }
    fwrite($fp, ":");
    fclose($fp);
    }

    ?>
    <script language="javascript">
    location.replace("<?php echo $PHP_SELF; ?>");
    </script>

    <meta http-equiv="refresh" content="0; url=<?php echo $PHP_SELF; ?>">
    <?php
    }
    if($Submit)
    {
    if($pass1 != $pass2)
    {
    echo "Re-enter password information and submit again";
    }
    else
    {
    $fp = fopen("/export/htdocs/Dept/Org/Student/wkugg/members/users.txt", "a");
    //$fp = fopen("users.txt", "a");
    fwrite($fp, "\n");
    fwrite($fp, $userid);
    fwrite($fp, ":");
    fwrite($fp, $pass1);
    fwrite($fp, ":");
    fwrite($fp, $name);
    fwrite($fp, ":");
    fwrite($fp, $mail);
    fwrite($fp, ":");
    if($mailshow)
    {
    fwrite($fp, "1");
    }
    else
    {
    fwrite($fp, "0");
    }
    fwrite($fp, ":");
    fwrite($fp, $newphone);
    fwrite($fp, ":");
    if($newphoneshow)
    {
    fwrite($fp, "1");
    }
    else
    {
    fwrite($fp, "0");
    }

    fwrite($fp, ":");
    if($memlev == 1)
    {
    fwrite($fp, "officer");
    }
    else
    {
    fwrite($fp, "member");
    }
    fwrite($fp, ":");
    fclose($fp);
    }
    if($Accept)
    {
    $fp = fopen("/export/htdocs/Dept/Org/Student/wkugg/members/users.txt", "a");
    //$fp = fopen("users.txt", "a");
    fwrite($fp, "\n");
    fwrite($fp, $userid);
    fwrite($fp, ":");
    fwrite($fp, $pass1);
    fwrite($fp, ":");
    fwrite($fp, $name);
    fwrite($fp, ":");
    fwrite($fp, $mail);
    fwrite($fp, ":");
    if($mailshow)
    {
    fwrite($fp, "1");
    }
    else
    {
    fwrite($fp, "0");
    }
    fwrite($fp, ":");
    fwrite($fp, $newphone);
    fwrite($fp, ":");
    if($newphoneshow)
    {
    fwrite($fp, "1");
    }
    else
    {
    fwrite($fp, "0");
    }

    fwrite($fp, ":");
    if($memlev == 1)
    {
    fwrite($fp, "officer");
    }
    else
    {
    fwrite($fp, "member");
    }
    fwrite($fp, ":");
    fclose($fp);
    }
    if($Deny)
    {
    mail("$mail", "Dear $name, \n \n I'm sorry, but you have been denied by the Webmaster to be added to the WKU Gamers' Guild website. This could be for many reasons. \n \n 1. You could have included insufficient information. Did you remember to include your full name, a valid e-mail, or other incorrect information. Please e-mail the Webmaster for more information or wait until the next meeting. \n 2. No record of you having ever been to a WKU Gamers' Guild meeting. We prefer to meet people before adding them to our website. After a meeting or two feel free to submit your form again (and try to make sure that your name is noted by the officers so that we will know who you are when you try again). \n 3. Any reason that has not be mentioned above, including officer discretion and technical errors. When you are unsure, then it is best to e-mail the Webmaster for more information. \n \n For more information, please contact the Webmaster at bowdemc@wku.edu.");
    }
    ?>
    There are two options on this page for submitting manually (submit) and editing (replace), which are where the other two options come from.

    I know that this is a long post, but I wanted to provide as much information as possible. Any help/suggestions that anyone has would be much appreciated. I can't figure out why those buttons aren't working.

    -Maria

  2. #2
    QuietDean's Avatar
    Administrator

    Status
    Offline
    Join Date
    Oct 2000
    Location
    Bournemouth, UK
    Posts
    2,662
    We always prefer all the information, dont worry about a long post Welcome to the forums Maria.

    The base of the problem seems to be that the form in the email does not work. I notice that there is no </form> tag, try adding one and see if it works.
    If one of our members helps you, please click the icon to add to their reputation!
    No support via email or private message - use the forums!
    Before you ask, have you Searched?

  3. #3
    QuietDean's Avatar
    Administrator

    Status
    Offline
    Join Date
    Oct 2000
    Location
    Bournemouth, UK
    Posts
    2,662
    Oh, and by-the-way, that form within the email is a great timesaving idea. I will be borrowing that one
    If one of our members helps you, please click the icon to add to their reputation!
    No support via email or private message - use the forums!
    Before you ask, have you Searched?

  4. #4
    Arcania's Avatar
    New User

    Status
    Offline
    Join Date
    Jul 2003
    Location
    Kentucky
    Posts
    7
    Quote Originally Posted by QuietDean
    Oh, and by-the-way, that form within the email is a great timesaving idea. I will be borrowing that one
    It'll help me a lot once I get it working. I wanted things to be as easy as possible for future webmasters of the site.

    Well, I added the end form tag, and it's still not working. I click the buttons and it's almost like there's no code there. I don't even get an error message.

  5. #5
    Arcania's Avatar
    New User

    Status
    Offline
    Join Date
    Jul 2003
    Location
    Kentucky
    Posts
    7
    Another note, while it views, even if the buttons don't work, with my university webmail, it won't with others. Within Outlook Express and Hotmail it showed the block of coding for the form, but did not run the coding. I tried changing the security settings, but it didn't affect Outlook, and I have no idea how to change anything like that for Hotmail (or even if it's possible).

    here's the block of code, I was testing with random information with only my email address being real to test the deny feature:

    <H2>Accept/Deny New Member</H2><form name="adddenyuser" enctype="multipart/form-data" method="post" action="http://www.wku.edu/gg/users2.php"><table><tr><td><FONT SIZE="4">Account Information</FONT><br><table><tr><td>Real Name:</td><td> <input type="text" name="name" value="again and";></td></tr><tr><td>User ID:</td><td> <input type="text" name="userid" value="again";></td></tr><tr><td>Password:</td><td> <input type="password" name="pass1" value="more";></td></tr></table></td><td><FONT SIZE="4">Member Details</FONT><br>Phone Number: <input type="text" name="newphone" value="524-5646";><br><input type="checkbox" name="newphoneshow" value="1" checked>Show Phone Number on Members page<br>E-mail Address: <input type="text" name="mail" value="mariebowden@hotmail.com";><br><input type="checkbox" name="mailshow" value="1" >Show E-mail Address on Members page<br><input type="checkbox" name="memlev" value="1" >Officer?<br></td></tr><tr><td><input type="submit" name="Accept" value="Accept"></td><td><input type="submit" name="Deny" value="Deny"></td></tr><tr>For record purposes, the password is: more</tr></table></form>
    I did notice the extra semi-colons in the above block, and removed them to see if that was the problem. Still doesn't work.
    Last edited by Arcania; 07-16-2003 at 04:07 PM.

  6. #6
    QuietDean's Avatar
    Administrator

    Status
    Offline
    Join Date
    Oct 2000
    Location
    Bournemouth, UK
    Posts
    2,662
    ahha. try adding this code to the mailer script -

    Code:
    $headers = "MIME-Version: 1.0\r\n"; 
    $headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
    then amending your mail function to look like this -

    Code:
    mail("bowdemc@wku.edu", "Accept/Deny Web Membership", "$body", $headers);
    Thats adds headers telling the mail client that this is html, and to treat it as such.

    let us know if it works
    If one of our members helps you, please click the icon to add to their reputation!
    No support via email or private message - use the forums!
    Before you ask, have you Searched?

  7. #7
    Arcania's Avatar
    New User

    Status
    Offline
    Join Date
    Jul 2003
    Location
    Kentucky
    Posts
    7
    Quote Originally Posted by QuietDean
    ahha. try adding this code to the mailer script -

    Code:
    $headers = "MIME-Version: 1.0\r\n"; 
    $headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
    then amending your mail function to look like this -

    Code:
    mail("bowdemc@wku.edu", "Accept/Deny Web Membership", "$body", $headers);
    Thats adds headers telling the mail client that this is html, and to treat it as such.

    let us know if it works
    Added what's above, and it does correct my viewing problem, however the buttons still don't work. I think it's because the submit variables (accept or deny) aren't being sent to the page where they're being processed. I'll keep working on it, and let you know if I fix it.

  8. #8
    Arcania's Avatar
    New User

    Status
    Offline
    Join Date
    Jul 2003
    Location
    Kentucky
    Posts
    7
    Haven't figured it out. I decided to try using a hidden variable that declared a value OnClick, but it didn't seem to work. I've found out that it could be several problems from permissions that are set up on the site for people logged in to variable passing.

    Here are my files in progress: http://www.wku.edu/gg/files/TestEmail.zip

    The original files are still on the site because I wanted to test them before replacing them.

    members2.php 's action points to testemailapp.php instead of sendapp.php.

    testemailapp.php has been changed to send html email instead of text email, buttons do not work, though they do display.

    users2.php had been changed to remove error messages if you're not logged or if you're not logged on as an officer. Processes the form. Has a form for manually adding on the page. Originally, used if($Accept) format, now using a switch with a variable from Email Form. Doesn't seem to be getting any variables from the email.

    I thought that the full files might be easier to look at since other things could be affecting the buttons working.

    WHOOPS! Included wrong files in zip file. I reuploaded with the correct files. Sorry about that. Also, fixed one small error where I used different cases on variable values, but still not working.
    Last edited by Arcania; 07-16-2003 at 05:50 PM.

  9. #9
    QuietDean's Avatar
    Administrator

    Status
    Offline
    Join Date
    Oct 2000
    Location
    Bournemouth, UK
    Posts
    2,662
    That makes sense, will have a look.

    Just a thought, have you condifered using links with querystrings instead of a form? It could be as simple as a form wont submit from within a mail client. i have not found any documentation confirming that, but will have a look at that also.

    (it would make sense to me, security)
    If one of our members helps you, please click the icon to add to their reputation!
    No support via email or private message - use the forums!
    Before you ask, have you Searched?

  10. #10
    Arcania's Avatar
    New User

    Status
    Offline
    Join Date
    Jul 2003
    Location
    Kentucky
    Posts
    7
    Quote Originally Posted by QuietDean
    That makes sense, will have a look.

    Just a thought, have you condifered using links with querystrings instead of a form? It could be as simple as a form wont submit from within a mail client. i have not found any documentation confirming that, but will have a look at that also.

    (it would make sense to me, security)
    Links with querystrings? I haven't looked into those, but I thought those were mostly for retrieving information and not for sending. I'll have to do some research. You're right that this is a security issue in some ways, but I thought I should try it since it would only be used by the Webmaster.

    I have heard rumors that it was not possible, but I wanted to try it since I hadn't found any evidence either way.

  11. #11
    QuietDean's Avatar
    Administrator

    Status
    Offline
    Join Date
    Oct 2000
    Location
    Bournemouth, UK
    Posts
    2,662
    It just worked for me

    I amended the email address to my own, uploaded to my webspace. When the email arrived I clicked the button and it submitted to http://www.wku.edu/gg/users2.php

    Whilst nothing happened @ that page, at least the client works fine.

    I am using Mozilla Thunderbird as my mail client. Maybe the problem is with the client?
    If one of our members helps you, please click the icon to add to their reputation!
    No support via email or private message - use the forums!
    Before you ask, have you Searched?

  12. #12
    QuietDean's Avatar
    Administrator

    Status
    Offline
    Join Date
    Oct 2000
    Location
    Bournemouth, UK
    Posts
    2,662
    Oh, a handy hint to check submitted variables. Add this to the target page -

    Code:
    <? print_r($HTTP_POST_VARS); ?>
    that will write out all form variables.
    If one of our members helps you, please click the icon to add to their reputation!
    No support via email or private message - use the forums!
    Before you ask, have you Searched?

  13. #13
    Arcania's Avatar
    New User

    Status
    Offline
    Join Date
    Jul 2003
    Location
    Kentucky
    Posts
    7
    Quote Originally Posted by QuietDean
    Oh, a handy hint to check submitted variables. Add this to the target page -

    Code:
    <? print_r($HTTP_POST_VARS); ?>
    that will write out all form variables.
    That helped. The variables were showing up. I just needed to place the if($Accept) and if($Deny) above the other if statements. It works fine now, but only within a mail client. It doesn't like webmail much. I'll have to do a little more testing with that though. Thanks for the help.

  14. #14
    QuietDean's Avatar
    Administrator

    Status
    Offline
    Join Date
    Oct 2000
    Location
    Bournemouth, UK
    Posts
    2,662
    np. Glad its working.
    If one of our members helps you, please click the icon to add to their reputation!
    No support via email or private message - use the forums!
    Before you ask, have you Searched?



Tags for this Thread