Send form to user and to mysql

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • LTCreationsLLC
    New Member
    • Apr 2008
    • 7

    Send form to user and to mysql

    I have a page that is used to create a user account. The form is "supposed" to send the username and password to the user upon successful completion of the form. But, it only sends the information to the database - at least that's done well. I've included the code from the page to find out if someone can tell me where I need to add the $mailto code and exactly how. I have seen many example, but not being a php programmer with mysql, I'm not sure that cut and paste from something that "should" work will work in this instance. Please look and let me know how to get the form to E-mail the username and password to the user:

    600 lines of code added as attachment

    The person who wrote the page, or should I say cut and pasted from other pages, failed to complete the assignment of making the page send to the user. However, the resulting page tells the user to expect the information in their E-mail.
    Help!

    Thanks.
    Attached Files
    Last edited by ronverdonk; Apr 11 '08, 10:17 AM. Reason: code within code tags!
  • TheServant
    Recognized Expert Top Contributor
    • Feb 2008
    • 1168

    #2
    Point 1: Use CODE tags in your post so it is easier to read.
    Point 2: Use <?php not <? as this will be removed in future php versions and it is good practice as <? can be used for XML I believe.

    I didn't read a lot of it closely, just skimmed because I don't have the time to sit through all that... However there is no mail() function in all that code you posted, so how do you expect it to email someone?

    You need to include a line with:
    [PHP]mail(to,subject ,message);[/PHP]
    Read more about it here.

    Come back when you have tried that and use the correct CODE tags or else no one will read it!

    Comment

    • LTCreationsLLC
      New Member
      • Apr 2008
      • 7

      #3
      Send form to user and to mysql

      Originally posted by LTCreationsLLC
      I have a page that is used to create a user account. The form is "supposed" to send the username and password to the user upon successful completion of the form. But, it only sends the information to the database - at least that's done well. I've included the code from the page to find out if someone can tell me where I need to add the $mailto code and exactly how. I have seen many example, but not being a php programmer with mysql, I'm not sure that cut and paste from something that "should" work will work in this instance. Please look and let me know how to get the form to E-mail the username and password to the user:


      The person who wrote the page, or should I say cut and pasted from other pages, failed to complete the assignment of making the page send to the user. However, the resulting page tells the user to expect the information in their E-mail.
      Help!

      Thanks.
      I hope the corrections are as required for the forum.
      Last edited by LTCreationsLLC; Apr 11 '08, 04:18 AM. Reason: Not posted properly

      Comment

      • LTCreationsLLC
        New Member
        • Apr 2008
        • 7

        #4
        Originally posted by TheServant
        Point 1: Use CODE tags in your post so it is easier to read.
        Point 2: Use <?php not <? as this will be removed in future php versions and it is good practice as <? can be used for XML I believe.

        I didn't read a lot of it closely, just skimmed because I don't have the time to sit through all that... However there is no mail() function in all that code you posted, so how do you expect it to email someone?

        You need to include a line with:
        [PHP]mail(to,subject ,message);[/PHP]
        Read more about it here.

        Come back when you have tried that and use the correct CODE tags or else no one will read it!
        Ok. I understand that I've posted incorrectly due to my newness to the forum. I also agree, as I pointed out in my post, that the $mailto is missing. My question is where would it go and what is the proper code to include?

        I could delete and then repost, but I don't see anywhere I can edit the original post.

        I'm going now to see if I can follow your suggested link. As I also mentioned, I'm not a php programmer. I can read and understand what's going on. But I'm not sure if I include something how it will effect the interaction with mysql.

        Thanks for your help. Don't give up on me...

        Comment

        • Markus
          Recognized Expert Expert
          • Jun 2007
          • 6092

          #5
          Originally posted by LTCreationsLLC
          Ok. I understand that I've posted incorrectly due to my newness to the forum. I also agree, as I pointed out in my post, that the $mailto is missing. My question is where would it go and what is the proper code to include?

          I could delete and then repost, but I don't see anywhere I can edit the original post.

          I'm going now to see if I can follow your suggested link. As I also mentioned, I'm not a php programmer. I can read and understand what's going on. But I'm not sure if I include something how it will effect the interaction with mysql.

          Thanks for your help. Don't give up on me...
          Would you be able to go back and edit your first post so that it's actually readable?

          Read the forum guidelines on how to do that.

          Regards.

          Comment

          • TheServant
            Recognized Expert Top Contributor
            • Feb 2008
            • 1168

            #6
            Originally posted by LTCreationsLLC
            as I pointed out in my post, that the $mailto is missing. My question is where would it go and what is the proper code to include? ... Don't give up on me...
            It doesn't matter where you include it, as long as it is in the place where the information is sent to (before or after your SQL stuff). I recommend after so that it will only send if your database update worked.

            And I am not giving up on you, trust me I am still very much in the beginner category of php. Unlike you however, that is the only knowledge I have, so I am a beginner in internet coding too!

            Comment

            • LTCreationsLLC
              New Member
              • Apr 2008
              • 7

              #7
              Originally posted by TheServant
              It doesn't matter where you include it, as long as it is in the place where the information is sent to (before or after your SQL stuff). I recommend after so that it will only send if your database update worked.

              And I am not giving up on you, trust me I am still very much in the beginner category of php. Unlike you however, that is the only knowledge I have, so I am a beginner in internet coding too!

              The original message can't be edited...or at least I have no idea how. I've opened it several time, tried to save it, and nothing changes. I can only reply to the message. Once it's saved, that's it.
              But, here is what I got to work...sort of:
              Code:
              mail( $user_email,$user_name,$user_password);
              I added that just before the end of the php, just as you suggested, although I did that before I saw your suggestion.
              The above works, although only the last attribute is sent via mail, and the "from" is not what I want. I'd like to assign the "from" address, but it comes from the default account of the site.

              I tried a LOT of other mailto configurations and nothing worked other than the above. I tried to add things to the beginning of the script, added things from the contact page that works well, added things from the listing page (another part of the site) and nothing works in "this" page but what I have above. The trick now is to get all 3 of the things I want sent, and I want to be able to assign a "from" E-mail address.

              I'm about burned out for the night on this. It's nearly 00:30 and I'm spent. If you come up with any great answers let me know.
              Thanks.

              Comment

              • ronverdonk
                Recognized Expert Specialist
                • Jul 2006
                • 4259

                #8
                Your code source if too large, so we can only read it by editing your post.
                Store the code in a .txt file and add it to your post as an attachment.

                another warning: Please enclose your posted code in [code] tags (See How to Ask a Question).

                This makes it easier for our Experts to read and understand it. Failing to do so creates extra work for the moderators, thus wasting resources, otherwise available to answer the members' questions.

                Please use [code] tags in future.

                MODERATOR

                Comment

                • LTCreationsLLC
                  New Member
                  • Apr 2008
                  • 7

                  #9
                  Attaching would be great...if I could see where to attach something in this reply window. I understand the moderator will allow attachments. I have the .txt file prepared if you would point me in the right direction. I've also made another foiled attempt to create what I want in the code.

                  Ok. I understand now that I can attach if I post then edit. So, here goes...

                  You can see on line 104 where I've been attemping to create the send. I used the mailto at the top with other clarifications, but it didn't work. Using the line 104 does work, but I obviously don't have the code correct to send everything I want. I get it to mail to the user, and the mail subject is the username and the body contains the last parameter I specifiy. This mimnal success was using the following:

                  Code:
                  mail($user_email;$user_password,$user_name);
                  So, how do I "correctly" write the above so that the message is sent to the user, the subject contains whatever, and the password along with user name are in the body of the message?
                  Attached Files

                  Comment

                  • LTCreationsLLC
                    New Member
                    • Apr 2008
                    • 7

                    #10
                    Almost working

                    I've been successful in creating the code necessary to send everything "except for" the user name and password from the form that is created/completed by the user. I've exhausted every possible combination that I can find/think to try and still need help. Where/how can I pull the user name and password from the form and send that to the user via E-mail as they submit the form? I've attached the updated version of the page in order to see what I used to make it 90% operable.
                    Attached Files
                    Last edited by LTCreationsLLC; Apr 12 '08, 02:05 AM. Reason: Attached new file

                    Comment

                    • LTCreationsLLC
                      New Member
                      • Apr 2008
                      • 7

                      #11
                      Originally posted by markusn00b
                      Would you be able to go back and edit your first post so that it's actually readable?

                      Read the forum guidelines on how to do that.

                      Regards.

                      I'm still pulling out my hair on this mail issue. Is there a possibility that you can provide some insight...pleas e? I've reposted and uploaded a txt file to show what I have for the php page. I'm 90% there, but can't figure out how to include the password and user name in the message that is sent to the user. I've been successful in sending the user message with all but the user name and password. Any thoughts? Thanks.

                      Comment

                      Working...