Apply for Zend Framework Certification Training

Zend Framework 2






FormRegistrationForm.php
< ?php
namespace MovieForm;
use ZendFormForm;

class RegistrationForm extends Form
{
	public function __construct()
	{
		parent::__construct('Movie');
		$this->add(array('name'=>'id','type'=>'hidden'));
		$this->add(array('name'=>'name','type'=>'text','options'=>
                           array('label'=>'Employee Name :'), 'attributes'=>array('id'=>'name')));
		$this->add(array('name'=>'address','type'=>'text','options'=>
                           array('label'=>'Employee Address :'),'attributes'=>array('id'=>'address')));
		$this->add(array('name'=>'submit','type'=>'submit','attributes'=>
                           array('value'=>'Register', 'id'=>'btn')));
	}
}
Viewmovieregister.phtml
< script >
	$(document).ready(function(){
		$("#btn").click(function(e){
			name	= $("#name").val();
			address	= $("#address").val();
			datastring="name="+name+"&address="+address;
			$.ajax({
				type:'POST',
				data:datastring,
				url:'http://localhost:8000/movie/register',
				success:function(data){
					$("#name").val("");
					$("#address").val("");
					$("#response").load("http://localhost:8000/movie/listall");
				}
			});
			return false;
		});
		
	});
< /script >


< ?php 
	echo $this->form()->openTag($register);
	echo $this->formHidden($register->get('id'));
	echo $this->formRow($register->get('name'));
	echo "
";
	echo $this->formRow($register->get('address'));
	echo "
";
	echo $this->formSubmit($register->get('submit'));
	echo $this->form()->closeTag();
? >
 

< First Last >



Ask a question



  • Question:
    {{questionlistdata.blog_question_description}}
    • Answer:
      {{answer.blog_answer_description  }}
    Replay to Question


Back to Top