How to convert this form in zend form - php

I've this HTML form, I need to write it in zend form.
I tried but failed
< form id="form" method="post" class="form">
<fieldset>
<div class="widget">
<div class="title"><img src="images/icons/dark/list.png" alt="" class="titleIcon" /><h6>Add new section</h6></div>
<div class="formRow">
<label>Section name:</label>
<div class="formRight">
<input type="text" name="cat_name" id="cat_name" value="" />
<input name="art_author" id="art_author" type="hidden" value="admin" />
</div>
<div class="clear"></div>
</div>
<div class="formSubmit">
<input type="submit" value="Add" class="redB" />
<input type="reset" value="Reset" class="brownB" />
</div>
<div class="clear"></div>
</div>
</fieldset>
Can any body help me please?

First step http://framework.zend.com/manual/1.12/en/learning.quickstart.intro.html
Second step http://framework.zend.com/manual/1.12/en/zend.form.html
And do not make copy paste. Try to make your zend_form work using Zend Manual.
Good luck!

Related

Trying to implement reCAPTCHA into my Contact form w/ Formspree [duplicate]

I find https://formspree.io/ really good and easy to use since I can edit my form as much as I like without having to touch a single line of php to process it.
Here´s my form.
<form action="//formspree.io/my#email.here" method="POST">
<div class="row uniform">
<div class="6u 12u$(large) 6u(medium) 12u$(xsmall)">
<label for="namn">Namn</label>
<input type="text" name="namn" id="namn" required/>
</div>
<div class="6u$ 12u$(large) 6u$(medium) 12u$(xsmall)">
<label for="epost">Epost</label>
<input type="email" name="_replyto" id="epost" required/>
</div>
<div class="12u$">
<label for="meddelande">Meddelande</label>
<textarea name="meddelande" id="meddelande" rows="5" required></textarea>
</div>
<div class="6u 12u$(large) 6u(medium) 12u$(xsmall)">
<input type="checkbox" id="prenumerera" name="prenumerera">
<label for="prenumerera">Prenumerera på mitt nyhetsbrev</label>
</div>
<div class="6u 12u$(large) 6u(medium) 12u$(xsmall)">
<div class="g-recaptcha" data-sitekey="public_site_key"></div>
</div>
<input type="hidden" name="_next" value="<?php echo $ROOT; ?>./tack.php" />
<input type="hidden" name="_subject" value="Kontakt!" />
<input type="text" name="_gotcha" style="display:none" />
<div class="12u$">
<ul class="actions">
<li><input type="submit" value="Skicka" class="special" /></li>
<li><input type="reset" value="Rensa" /></li>
</ul>
</div>
</div>
</form>
So.. How can I verify the input from reCaptcha when I don't have to process the form through php?
Thank you!
Formspree now redirects all form submissions to a reCaptcha page before finishing the submission. So there's no need to use the _gotcha anymore unless you pay for Gold level and don't want the reCaptcha functionality.
For more see https://formspree.io/
Captcha is not supported by formspree.
What you can do (and what you have done) is add a _gotcha hidden input, so spammer will likely fill it.
If you want a catpcha, you may want to process the form by yourself.

Is it possible to use googles reCaptcha with formspree?

I find https://formspree.io/ really good and easy to use since I can edit my form as much as I like without having to touch a single line of php to process it.
Here´s my form.
<form action="//formspree.io/my#email.here" method="POST">
<div class="row uniform">
<div class="6u 12u$(large) 6u(medium) 12u$(xsmall)">
<label for="namn">Namn</label>
<input type="text" name="namn" id="namn" required/>
</div>
<div class="6u$ 12u$(large) 6u$(medium) 12u$(xsmall)">
<label for="epost">Epost</label>
<input type="email" name="_replyto" id="epost" required/>
</div>
<div class="12u$">
<label for="meddelande">Meddelande</label>
<textarea name="meddelande" id="meddelande" rows="5" required></textarea>
</div>
<div class="6u 12u$(large) 6u(medium) 12u$(xsmall)">
<input type="checkbox" id="prenumerera" name="prenumerera">
<label for="prenumerera">Prenumerera på mitt nyhetsbrev</label>
</div>
<div class="6u 12u$(large) 6u(medium) 12u$(xsmall)">
<div class="g-recaptcha" data-sitekey="public_site_key"></div>
</div>
<input type="hidden" name="_next" value="<?php echo $ROOT; ?>./tack.php" />
<input type="hidden" name="_subject" value="Kontakt!" />
<input type="text" name="_gotcha" style="display:none" />
<div class="12u$">
<ul class="actions">
<li><input type="submit" value="Skicka" class="special" /></li>
<li><input type="reset" value="Rensa" /></li>
</ul>
</div>
</div>
</form>
So.. How can I verify the input from reCaptcha when I don't have to process the form through php?
Thank you!
Formspree now redirects all form submissions to a reCaptcha page before finishing the submission. So there's no need to use the _gotcha anymore unless you pay for Gold level and don't want the reCaptcha functionality.
For more see https://formspree.io/
Captcha is not supported by formspree.
What you can do (and what you have done) is add a _gotcha hidden input, so spammer will likely fill it.
If you want a catpcha, you may want to process the form by yourself.

How do I use 1 submit button to do 2 actions?

I'm trying to submit data to a list in my mail chimp but also allow the user to upload a file.
Here is my code, the first chunk is the mailchimp autogenerated form which is submitted via:
<div class="clear"><input type="submit" value="Subscribe" name="subscribe" id="mc-embedded-subscribe" class="button"></div>
and then it's followed by the basic code to submit a file. But at the moment both functions have a submit button. I want only one. Can anyone help?
<body>
<!-- Begin MailChimp Signup Form -->
<div id="mc_embed_signup">
<form action="http://test.us7.list-manage.com/subscribe/post?u=d12b70d4bb1e08c1568d5b392&id=bfb41cbf75" method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank" novalidate>
<h2>Subscribe to our test mailing list</h2>
<div class="indicates-required">
<span class="asterisk">*</span> indicates required
</div>
<div class="mc-field-group">
<label for="mce-EMAIL">
Email Address <span class="asterisk">*</span>
</label>
<input type="email" value="" name="EMAIL" class="required email" id="mce-EMAIL">
</div>
<div class="mc-field-group">
<label for="mce-FNAME">First Name </label>
<input type="text" value="" name="FNAME" class="" id="mce-FNAME">
</div>
<div class="mc-field-group">
<label for="mce-LNAME">Last Name </label>
<input type="text" value="" name="LNAME" class="" id="mce-LNAME">
</div>
<div class="mc-field-group input-group">
<strong>Interests </strong>
<ul>
<li><input type="checkbox" value="1" name="group[5597][1]" id="mce-group[5597]-5597-0"><label for="mce-group[5597]-5597-0">Interest 1</label></li>
<li><input type="checkbox" value="2" name="group[5597][2]" id="mce-group[5597]-5597-1"> <label for="mce-group[5597]-5597-1">Interest 2</label></li>
<li><input type="checkbox" value="4" name="group[5597][4]" id="mce-group[5597]-5597-2"><label for="mce-group[5597]-5597-2">Interest 3</label></li>
</ul>
</div>
<div id="mce-responses" class="clear">
<div class="response" id="mce-error-response" style="display:none"></div>
<div class="response" id="mce-success-response" style="display:none"></div>
</div>
</div>
<form action="upload_file.php" method="post" enctype="multipart/form-data">
<label for="file">Filename:</label>
<input type="file" name="file" id="file"><br>
<input type="submit" name="submit" value="Submit">
<div class="clear">
<input type="submit" value="Subscribe" name="subscribe" id="mc-embedded-subscribe" class="button">
</div>
</form>
</form>
</body>
You could accomplish this by routing the MailChimp information through your upload_file.php file.
MailChimp has a great API that you can use for more than just adding a subscriber to a list. You would specifically want the listSubscribe() function. There are some great examples on that page.
Here's more documentation on MailChimp's API: http://apidocs.mailchimp.com/api/2.0/
So in your HTML, you would want to remove the second submit button and make it one form with action="upload_file.php". The PHP file would upload the file, then use the API to submit the data to MailChimp.
You html should look like this:
<body>
<!-- Begin MailChimp Signup Form -->
<div id="mc_embed_signup">
<form action="upload_file.php" method="post" enctype="multipart/form-data">
<h2>Subscribe to our test mailing list</h2>
<div class="indicates-required">
<span class="asterisk">*</span> indicates required
</div>
<div class="mc-field-group">
<label for="mce-EMAIL">
Email Address <span class="asterisk">*</span>
</label>
<input type="email" value="" name="EMAIL" class="required email" id="mce-EMAIL">
</div>
<div class="mc-field-group">
<label for="mce-FNAME">First Name </label>
<input type="text" value="" name="FNAME" class="" id="mce-FNAME">
</div>
<div class="mc-field-group">
<label for="mce-LNAME">Last Name </label>
<input type="text" value="" name="LNAME" class="" id="mce-LNAME">
</div>
<div class="mc-field-group input-group">
<strong>Interests </strong>
<ul>
<li><input type="checkbox" value="1" name="group[5597][1]" id="mce-group[5597]-5597-0"><label for="mce-group[5597]-5597-0">Interest 1</label></li>
<li><input type="checkbox" value="2" name="group[5597][2]" id="mce-group[5597]-5597-1"> <label for="mce-group[5597]-5597-1">Interest 2</label></li>
<li><input type="checkbox" value="4" name="group[5597][4]" id="mce-group[5597]-5597-2"><label for="mce-group[5597]-5597-2">Interest 3</label></li>
</ul>
</div>
<div id="mce-responses" class="clear">
<div class="response" id="mce-error-response" style="display:none"></div>
<div class="response" id="mce-success-response" style="display:none"></div>
</div>
</div>
<label for="file">Filename:</label>
<input type="file" name="file" id="file"><br>
<div class="clear">
<input type="submit" value="Subscribe" name="subscribe" id="mc-embedded-subscribe" class="button">
</div>
</body>

PHP not posting form enteries to the same page

Here's a form I have. I want to post the form entries to the same page and then do something else with it. However, echoing the values doesn't seem to be working. What am I doing wrong?
Here's the HTML part:
<div class="well">
<form name="myform" class="form-horizontal" id="form" onsubmit="return validateForm(this);" action="my.php" method="post">
<div class="control-group input-append">
<label for="text" class="control-label">Field1</label>
<div class="controls">
<div class="left">
<input id="Field1" name="Field1" type="text"/>
</div>
</div>
</div>
<br>
<div class="control-group input-append">
<label for="passwd" class="control-label">Field2</label>
<div class="controls">
<div class="left1">
<input id="Field2" name="Field2" type="password" />
</div>
</div>
</div>
<br>
<div class="control-group input-append">
<label for="passwd" class="control-label">Field3</label>
<div class="controls">
<div class="left1">
<input id="Field3" name="Field3" type="password"/>
</div>
</div>
</div>
<br>
<div class="control-group input-append">
<label for="select" class="control-label">Field4</label>
<div class="controls">
<div class="left1">
<select class="form-control" name="Field4">
<option value="OP1">OP1</option>
<option value="OP2">OP2</option>
<option value="OP3">OP3</option>
<option value="OP4">OP4</option>
</select>
</div>
</div>
</div>
<br>
<div class="control-group input-append">
<label for="text" class="control-label">Field5</label>
<div class="controls">
<div class="left">
<input type="Field5" id="Field5" name="type"/>
</div>
</div>
</div>
<br>
<div class="control-group input-append">
<label for="text" class="control-label">Field6</label>
<div class="controls">
<div class="left">
<input type="text" id="Field6" name="Field6"/>
</div>
</div>
</div>
<br>
<div class="control-group">
<div class="controls">
<div class="left1">
<input type="submit" class="btn btn-success"/>
</div>
</div>
</div>
</form>
</div>
PHP part:
<?php
if (isset($_POST['submit']))
{
echo $_POST['name'];
} else {?>
<?php;}?>
There is no field with the name $_POST['name'], though you have fields with numbered names, e.g. $_POST['Fields3'].
To debug the form request print out the whole $_POST array first:
var_dump( $_POST );
The type of an input is not the same as it's name!
Another option is to replace
if (isset($_POST['submit']))
with:
if($_SERVER['REQUEST_METHOD'] == 'POST')
Replace <input type="submit" class="btn btn-success"/>
to <input type="submit" name="submit" class="btn btn-success"/>
The problem is here:
if (isset($_POST['submit']))
Your submit button
<input type="submit" class="btn btn-success" />
does not have a value, nor does it have a name. Post works with these attributes:
$_POST['<name>'] = <value>
change your input to
<input type="submit" name="submit" value="Submit" class="btn btn-success" />
Btw, nice to see people still coding in XHTML. If you are using HTML 5, you should not end your non-closing tags with a slash ... />.

Formmail Redirect Issue

I'm trying to get a Formmail form to re-direct back to it's own page. For example, if I'm on the page, http://www.rightfittech.com/paincenter/contact-us.html, I would like the re-direct to go back to http://www.rightfittech.com/paincenter/contact-us.html, which is the same page.
I searched Google like crazy, and no worthwhile results. The forums keep saying to create a hidden input field
BUT THIS IS NOT WORKING!!!
My code below, and note that I didn't modify formmail, except for email addresses!
<form action="http://www.rightfittech.com/paincenter/formmail.php" name="Contact" method="post"
id="form1">
<input type="hidden" name="env_report" value="REMOTE_HOST,REMOTE_ADDR,HTTP_USER_AGENT,AUTH_TYPE,REMOTE_USER" >
<input type="hidden" name="redirect" value="http://www.rightfittech.com/paincenter/contact-us.html"/>
<input type="hidden" name="recipients" value="robertmyrick#hotmail.com" >
<input type="hidden" name="mail_options" value="FromAddr=robertmyrick#hotmail.com" >
<input type="hidden" name="subject" value="New Contact" >
<div class="wrapper row-2">
<div class="col-1">
<div class="form">
<label>First Name:</label>
<input type="text" />
</div>
<div class="form">
<label>Last Name:</label>
<input type="text" />
</div>
<div class="form">
<label>E-mail:</label><br/>
<input type="text" />
</div>
<div class="form">
<label>Phone Number:</label>
<input type="text" />
</div>
</div>
<div class="col-2">
<div>
<label>Enter Your Message:</label>
<textarea cols="1" rows="1"></textarea>
</div>
<div class="wrapper">
<div class="alignright" style="float:left">
<em><b>Clear</b></em>
<div style="width:20px; float:left"> </div>
<em><b>Submit</b></em></div>
</div>
</form>
Try setting the value good_url instead of redirect.
Like so:
<input type="hidden" name="good_url"
value="http://www.rightfittech.com/paincenter/contact-us.html"/>

Categories