How to apply target value in zend form? - zend-framework

I have the same requirement like PHP + POST an HTML form from inside an iFrame and redirect parent
<form action".." target="_top">
</form>
I am using zend,I have to apply target="_top" in zend form. How can i do this in zend from

I found it by use ,
$this->setAttrib('target', '_top');

Related

Codeigniter 4 form action path

sorry for the very noob question. I have a page : www.example.com/edit/3 with form inside.
<form class="" action="" method="post">
Usually my form action I will specify something like add, register, etc. In this case, I am not sure how do I specify it. Currently it is working when I save it if I leave it blank without specifying anything. But I am not sure is this the right way to do it.
Controller
public function edit_game(){}
Routes
$routes->match(['get', 'post'], 'account/edit_game/(:num)', 'Addgame::edit_game/$1');
Can anyone advise?
action="" is the URI to which send the form data, aka the controller where you treat the received data. If not specified, it will be the same page as the one you are currently on.
What you can do:
<form method="post">
</form>
<form method="post" action=""> <!-- same as previous -->
</form>
<form method="post" action="/some/page">
</form>
In the last example, note the leading /, it means it is according to the site root. If you forget it, it will be relative to the current URI.
Exemple, if the page containing the <form> is http://example.com/edit/3:
action="/some/page" will redirect to http://example.com/some/page.
action="some/page" will redirect to http://example.com/edit/some/page

add captcha in HTML from using Symfony 3

Hi i want to use captcha in an html form in a Symfony 3.4 project , i installed and implemented the captcha bundle (Gregwar's CaptchaBundle)successfully but in the bundle's documentation in the part of adding the captcha to the form they are working with symfony form builder but i am working with normal HTML form using requests .
this is the code they provided in the bundle's documentation :
<?php
use Gregwar\CaptchaBundle\Type\CaptchaType;
// ...
$builder->add('captcha', CaptchaType::class); // That's all !
// If you're using php<5.5, you can use instead:
$builder->add('captcha', 'Gregwar\CaptchaBundle\Type\CaptchaType');
// ...
this is my html form where i want to add the captcha
<form class="row" method="post" action="{{path('envoyerchat')}}">
<input type="text" name="test2">
<input type="text" name="test1">
<!-- add captcha here -->
<!-- add captcha here -->
<input type="submit">
</form>
can i convert that code which works with fom builder to my html form ?

PHP 5.3.10 global behaviour

I'm having trouble with a global variable, I think it might be pulling its data from a HTML Form Input, but I can't find any documentation on the web about global var pulling data from a HTML Form Input.
Thanks.
When a form is submitted the method tag specifies if it is a POST or GET request. Depending on what method your form is using your form values can either be in your $_POST or $_GET Super global.
Example:
<form action="welcome.php" method="post">
Name: <input type="text" name="name"><br>
E-mail: <input type="text" name="email"><br>
<input type="submit">
</form>
After the submit button on the form is clicked the form contents can be found by referencing the name attribute in the super global(In this case the POST).
$_POST['name']
$_POST['email']
For documentation see
http://php.net/manual/en/reserved.variables.post.php
This applies to PHP 4 >= 4.1.0, PHP 5, PHP 7 ie. fits PHP 5.3.

WordPress : Redirect a form validation & submit

What would be the best way to redirect a form after validation & submit? The form isn't a plugin, it's part of a theme.
a) This is the form action code:
<form action="" id="pro_form" enctype="multipart/form-data" method="post">
b) Here's the validation string:
<input type="submit" onclick="return validation()" value="Submit" >
Any help would be appreciated. Thanks!
Peter
I am not sure if this is want you are asking for, but in my opinion the best way is using javascript, like this:
echo '<script type="text/javascript">window.location ="NewLocation";</script>';
Place this code after the form returns from validation.

submitting the form in iframe and redirect the whole page

I guess I have an easy question, I have not found the right answer yet though.
I have an iframe in my page that comes from an external domain. After submitting the form which is inside this iframe, I would like to redirect the whole page, not just the content inside the iframe - I guess the right way to achieve might be via "target" attribute.
The sample html:
<html>
<body>
<h1>main page</h1>
<iframe src="http://example.com">
<form url="http://example.com/action">
...
</form>
</iframe>
</body>
</html>
Submitting the form should show me the result of submitting the POST request as a new page (not in the iframe)
I have put target='_parent' in the iframe but I haven't done this initially in the form element. After adding target='_parent' attribute to form it started to work as expected.
Add a target attribute to the form within the iframe:
<form action="foobar" method="post" target="_parent">
...
</form>