Hello again!
I have this simple email contact form that I'm using in my site for visitors to send questions etc. But right now in "From" and "Subject" fields it just enters previously set values which is a bit inconvenient. I would like to have senders email and subject he enters in my contact form to show up.
Here's my code for the form itself.
I'm also using phpmailer but that shouldn't change anything here.
Thank you!
P.S. I'm sorry if there has been a question like this before. Ran through search results and didn't see it.
I have this simple email contact form that I'm using in my site for visitors to send questions etc. But right now in "From" and "Subject" fields it just enters previously set values which is a bit inconvenient. I would like to have senders email and subject he enters in my contact form to show up.
Here's my code for the form itself.
- Code: Select all
<cms:form action='' method='post' id='contact_form'>
<h3>Contact Us</h3>
<ul>
<li class="clearfix">
<label for="name">Name</label>
<cms:input type='text' name='name' id='name' required='1' />
<div class="clear"></div>
<cms:if k_error_name>
<p id='name_error' class='error' style="display:block">Insert a Name</p>
</cms:if>
</li>
<li class="clearfix">
<label for="email">Email Address</label>
<cms:input type='text' name='email' id='email' required='1' />
<div class="clear"></div>
<cms:if k_error_email>
<p id='email_error' class='error' style="display:block">Enter a valid email address</p>
</cms:if>
</li>
<li class="clearfix">
<label for="subject">Subject</label>
<cms:input type='text' name='subject' id='subject' required='1' />
<div class="clear"></div>
<cms:if k_error_subject>
<p id='subject_error' class='error' style="display:block">Enter a message subject</p>
</cms:if>
</li>
<li class="clearfix">
<label for="message">Message</label>
<cms:input type='textarea' name='message' id='message' required='1' rows="30" cols="30"></cms:input>
<div class="clear"></div>
<cms:if k_error_message>
<p id='message_error' class='error' style="display:block">Enter a message</p>
</cms:if>
</li>
<li class="clearfix">
<cms:if k_success>
<p id='mail_success' class='success' style="display:block; background: rgb(255, 255, 255); background: rgba(255, 255, 255, .7); border-radius: 3px; padding: 5px; margin-left: 20px;">
<span>Thank you. We will get back to you as soon as possible.</span>
</p>
<cms:send_mail from=k_email_from to=k_email_to subject='Feedback from your site'>
The following is an email sent by a visitor to your site:
<cms:show k_success />
</cms:send_mail>
</cms:if>
<p id='mail_fail' class='error' style="background: rgb(255, 255, 255); background: rgba(255, 255, 255, .7); border-radius: 10px;">
Sorry, an error has occured. Please try again later.
</p>
<div id="button">
<input type='submit' id='send_message' class="button" value='Submit' />
</div>
</li>
</ul>
</cms:form>
I'm also using phpmailer but that shouldn't change anything here.
Thank you!
P.S. I'm sorry if there has been a question like this before. Ran through search results and didn't see it.