(Moderator's note: The original title was: "submit button in wordpress.")

I'd like to create a registration form to send an email.

I've tried Contact Form 7 but I would like to use my own HTML <form>. I can do the entire coding but I just want to know the code for the "submit" button so that the registrations goes directly to my admin email ID as I don't think the normal HTML code for the submit button will work.

Can anyone help me out in this?

1 Answer 1


While you might be able to do something on the client with jQuery I think your best bet would be to use the Post/Redirect/Get Pattern and submit your registration form via a <form method='post'> action.

The code after the screenshot below is a "Page Template" for a "Page" illustrates how to achieve what you've asked for with WordPress. Copy the code to your theme directory as page-contact-form.php (or some other name you like better) and then create a page that has template set to "Contact Form" as you see in the screenshot (note I kept the page template as simple as possible to illustrate the technique; you'll typically have a lot more code in your real live page templates):

Using a Page Template in WordPress 3.0
(source: mikeschinkel.com)

  Template Name: Contact Form
if (count($_POST)) {
  $admin_user = get_userdatabylogin(ADMIN_USER);
  $registered_email = $_POST['email'];
    'New Site Registration',
    "New Site Registration:\n\tEmail: {$registered_email}.");
<?php get_header(); ?>
<?php if (count($_POST)): ?>
    <p>Hey <?php echo $_POST['email']; ?>, thanks for registering!</p>
<?php else: ?>
  <form method="post">
    Email: <input type="text" name="email" />
    <input type="submit" value="Register" />
<?php endif; ?>
<?php get_footer(); ?>

After you've created your page with the above page template it might look something like this on your external site:

Simple Registration Form for WordPress, Part 1
(source: mikeschinkel.com)

And this might be what it looks like after a visitor registers:

Simple Registration Form for WordPress, Part 2
(source: mikeschinkel.com)

  • thanks for your answer it solved my problem, i have put this form in single.php, so that it appears after post ends but i would like put this in a jquery section, i mean when after a user clicks on link like "Open" the a slide down jquery will show the form just like this example api.jquery.com/slideDown but when i try this by putting it into my file(single.php), my entire page is disturbed, i tried it by putting in header file but it is not working Dec 3, 2010 at 7:47
  • @ntechi - To use jQuery+AJAX the techniques are completely different than to use HTTP POST. See bit.ly/gVCiWB bit.ly/h4Joh2 bit.ly/fMxKNe bit.ly/hD1y39 bit.ly/f1R7zV bit.ly/epoPYf Dec 3, 2010 at 8:52
  • i have tried jquery code in a proper manner, here is the code and images this is the image of my jquery code i55.tinypic.com/rsfslh.jpg and this is the image of my website sidebar, which is not proper i52.tinypic.com/2gxe90p.jpg in this the jquery is working, but just the sidebar is not proper am i doing anything wrong?? Dec 3, 2010 at 9:18
  • @ntechi - Your question in the comments is evolving to be very different from the original question you asked on this page, and it's too hard to discuss in the comments. Ask another question here at WordPress Answers and be sure to give all the details. Not sure if I'll have time to answer it but I'm sure someone will (and please, it will help if you use proper capitalization so it will be easier to read your question.) Dec 3, 2010 at 9:24

Not the answer you're looking for? Browse other questions tagged or ask your own question.