Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 458607
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T22:41:19+00:00 2026-05-12T22:41:19+00:00

How does one link to the submit button, I am thinking of embedding a

  • 0

How does one link to the submit button, I am thinking of embedding
a or just using href or actually have the entire php emailer code embedded somehow inside the submit section?

I can submit the information supplied by a user to a MySQL database and log it there; however, I was just wondering if there is a more elegant way to send email using the information saved in my database by the user after clicking on submit, or would I have to just script some php emailer and use the code below to link to it, so that when the user clicks submit, I have a copy on my database and the other copy is sent to my email in box?

More code can be supplied as requested, thank you for not flaming the newb.

<label for="submit">Submit</label>
<input id="submit" type="submit" value="Send Email!" /><br />
</p>
</form>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T22:41:19+00:00Added an answer on May 12, 2026 at 10:41 pm

    How does one link to the submit button
    On a webpage, an input element with ‘submit’ as its ‘type’ attribute inside a form element will submit the form to the URL specified in the form’s ‘action’ attribute and the response will be loaded in the window supplied in the form’s ‘target’ attribute.

    <form action='process.php' target='_blank' id='emailForm'>
        <input type='text' name='email' />
        <input type='submit' value='Send Email!' />
    </form>
    

    The code above will submit what the user enters (upon clicking the ‘Send Email!’ button) in the ’email’ text field to ‘process.php’ and the page it returns will be shown in a new window.

    I am thinking of embedding a or just using href
    If you don’t want to use a submit button like the example above, the code below will produce the same results as the submit button.

    <a href='javascript:document.getElementById("emailForm").submit();'>
        <img src='images/submit.jpg' />
    </a>
    

    have the entire php emailer code embedded somehow inside the submit section
    Unless you’re talking about AJAX, there’s a clear distinction between the capability of code executed on the client side (JavaScript) and server side (PHP).

    JavaScript code is executed from the client side and lets you check for potential errors (and stop a form being submitted) prior to submitting a form, like a space in an email address or letters where the entry is supposed to be numeric.

    PHP code is executed from the server side and saves the email address (or whatever else needs saving) in a database. It is also capable of sending emails. For security reasons, you should not depend solely on JavaScript for error-checking and the same checks, like spaces in email addresses and letters where the entry’s supposed to be numeric, should be carried out in the PHP too.

    I can submit the information supplied by a user to a MySQL database and log it there; however, I was just wondering if there is a more elegant way to send email using the information saved in my database
    If I understand you correctly, you now have a form that submit to a PHP file which in turn records the contents of that form (an email address) to a MySQL database which you check from time to time. Now your objective is to have the email address sent to your inbox in addition to being recorded in the MySQL database, is that right? All you need to do is to append this code to your existing PHP file that currently writes to your MySQL database.

    $to = "my_address@email.com";
    $subject = "New email address!";
    $body = "Hi,\n\nYou have a new email address:\n" . $_REQUEST['email'];
    if (mail($to, $subject, $body)) {
        echo("<p>Message successfully sent!</p>");
    } else {
        echo("<p>Message delivery failed...</p>");
    }
    

    Different hosting service providers may have different rules governing sending of emails like requiring a from field, or the from field needs to contain an email address matching the domain the form is hosted on, etc. Check with your service provider if you have problems sending mail.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 524k
  • Answers 524k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer In your Xml Layout has the problem: set layout Orientation… May 16, 2026 at 10:02 pm
  • Editorial Team
    Editorial Team added an answer The work around until this is fixed, is to place… May 16, 2026 at 10:02 pm
  • Editorial Team
    Editorial Team added an answer You have only declared the methods of the class. You… May 16, 2026 at 10:02 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

Update: The link below does not have a complete answer . Having to set
Let's imagine a HTML-form with with two submit buttons. one of them is positioned
I have a simple form created using Ajax.BeginForm : <% using (Ajax.BeginForm(Update, Description, new
I have an asp.net MVC app. One of the forms posts json data to
As in the following link, one can stop, start, and stop, then start a
I have a simple web-site. Almost every action takes int toonId as an argument
I have a form that posts to a url which triggers file download. The
I have a legacy system where I want to improve the user experience. On
I've used the free edition of the WebAii test framework [the one released by
I have a joomla site where users can log in. Once logged in, a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.