Hi,

I'm not sure if I have understood you correctly, but you want to share
a post with somebody, and when you go to /posts/sharethis/22 it wont
let you fill in the form first?

Looking at your code, the E-mail will always send first because it
appears before the code for the form. If you wanted to use the same
action to retrieve the form details and then send the data you would
need to use conditional statements (E.g. if the form isn't empty -
send the E-mail).

I would have one action to retrieve the details from the form and
store them, then redirect to the sharethis action which sends out the
E-mail from the variables given in the form.

Sorry if I have misunderstood what you was trying to acheive.

On Oct 15, 3:56 pm, Simon <[email protected]> wrote:
> hi i'm creating mailto with cakephp email components to share the post
> how do i do this with the form the have to fill out
>
> form:
> to:
> comment:
>
> then submit send that post id and the content of post  this is i did
> so far  when i go to posts/sharethis/22 it sends email but wont let me
> fill the form first
>
> function sharethis($id) {
>     $this->layout = null;
>     $Post = $this->Post->read(null,$id);
>     $this->Email->to =  $this->data['Post']['to'],;
>     $this->Email->bcc = array('[email protected]');
>     $this->Email->subject = 'Welcome to our really cool thing';
>     $this->Email->replyTo = '[email protected]';
>     $this->Email->from = $this->data['Post']['from'],;
>     $this->Email->template = 'Post'; // note no '.ctp'
>     //Send as 'html', 'text' or 'both' (default is 'text')
>     $this->Email->sendAs = 'html';
>
>      $this->set('post', $this->Post->read(null, $id));
>
>  if ( $this->Email->send() ) {
>
>                     $this->redirect('/thankyou');
>                         } else {
>                                 $this->Session->setFlash(__('this could not 
> be saved. Please, try
> again.', true));
>                         }
>  }
>
> <?php
>                 echo $form->create('post', array('action' =>
> 'sharethis'));
>                 echo $form->inputs(array('legend' => false,
>                                          'fieldset' => false,
>                                          'from',
>                                          'to',
>                                          'comments' => array('row' =>
> 10,
>                                                              'cols' =>
> 45,
>                                                              ),
>                                          ));
>
>                                 echo $form->submit('/img/submit.gif', 
> array('alt' =>
> 'Submit','class' => 'image'));
>                                 echo $form->end();
>             ?>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to