I built a simple contact request form using FormHelper. The form is
located on 'pages/contact' and the form action is located on
'contact_requests/add'. The form handler will email the request to the
address set by the administrator, and will save a copy of the request
to the database.
To create the form I wrote the following:
<?php echo $this->Form->create('ContactRequest', array('url' =>
array('controller' => 'contact_requests', 'action' => 'add')); ?>
When I click submit, instead of being brought to 'contact_requests/
add' I am brought to 'contact_requests/'. I have tried to write the
url in the form of address and this didn't help. The only other info I
can give is the first few times I tested the form it worked as
expected, but after a few times, the new (wrong) behavior came along
and won't go away.
Here is the rest of the code for the form. Does anyone know what the
problem could be?
<?php echo $this->Form->create('ContactRequest', array('url' =>
'http://localhost/trial/contact_requests/add', 'div' => false));?>
<?php echo $this->Form->input('ContactRequest.name', array('label' =>
'Name:', 'type' => 'text', 'maxLength' => '50', 'div' => false));?>
<?php echo $this->Form->input('ContactRequest.email', array('label' =>
'Email:', 'type' => 'text', 'maxLength' => '50', 'placeholder' =>
'[email protected]', 'div' => false));?>
<?php echo $this->Form->input('ContactRequest.phone', array('label' =>
'Phone:', 'type' => 'tel', 'maxLength' => '13', 'placeholder' => 'XXX-
XXX-XXXX', 'div' => false));?>
<?php echo $this->Form->input('ContactRequest.ext', array('label' =>
'Extension:', 'type' => 'text', 'name' => 'ext', 'maxLength' => '5',
'div' => false));?>
<?php echo $this->Form->label('Message:');?>
<?php echo $this->Form->textarea('ContactRequest.message',
array('maxLength' => '100', 'wrap' => 'soft', 'placeholder' =>
'maximum 100 characters', 'div' => false));?>
<?php echo $this->Form->button('Submit');?>
<?php echo $this->Form->end();?>
<?php echo $this->Form->input('ContactRequest.name', array('label' =>
'Name:', 'type' => 'text', 'maxLength' => '50', 'div' => false));?>
<?php echo $this->Form->input('ContactRequest.email', array('label' =>
'Email:', 'type' => 'text', 'maxLength' => '50', 'placeholder' =>
'[email protected]', 'div' => false));?>
<?php echo $this->Form->input('ContactRequest.phone', array('label' =>
'Phone:', 'type' => 'tel', 'maxLength' => '13', 'placeholder' => 'XXX-
XXX-XXXX', 'div' => false));?>
<?php echo $this->Form->input('ContactRequest.ext', array('label' =>
'Extension:', 'type' => 'text', 'name' => 'ext', 'maxLength' => '5',
'div' => false));?>
<?php echo $this->Form->label('Message:');?>
<?php echo $this->Form->textarea('ContactRequest.message',
array('maxLength' => '100', 'wrap' => 'soft', 'placeholder' =>
'maximum 100 characters', 'div' => false));?>
<?php echo $this->Form->button('Submit');?>
<?php echo $this->Form->end();?>
Check out the new CakePHP Questions site http://cakeqs.org and help others with
their CakePHP related questions.
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en