SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Thread: Form action

  1. #1
    SitePoint Enthusiast
    Join Date
    Jul 2006
    Posts
    73
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Form action

    $action=$_REQUEST['todo'];
    if($action=='Outreach Letter')
    {
    $form_action='outreachletter.php';
    }
    if($action=='Seminar letter')
    {
    $form_action='temp.php';
    }
    if($action=='Outreach Postcard')
    {
    $form_action='postcard.php';
    }
    ?>
    <form action="<? echo $form_action;?>" method="post" name="frmTemp" enctype="multipart/form-data" >



    after all information putting in the text box, when i click the button first time then it does not go in the page but second time it goes the particular page.

    how i solve this?
    plz help anyone.

  2. #2
    rajug.replace('Raju Gautam'); bronze trophy Raju Gautam's Avatar
    Join Date
    Oct 2006
    Location
    Kathmandu, Nepal
    Posts
    4,013
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Can you post your whold code? Have you put your to define the form action page in some JavaScript events? Otherwise if you have loaded the code before the form tag, then it must work.
    Mistakes are proof that you are trying.....
    ------------------------------------------------------------------------
    PSD to HTML - SlicingArt.com | Personal Blog | ZCE - PHP 5

  3. #3
    SitePoint Enthusiast Chousho's Avatar
    Join Date
    Jun 2006
    Posts
    97
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
    $action = strtolower($_REQUEST['todo']);
    switch ($action) {
    case 'outreach letter':
    	$form_action = 'outreachletter.php';
    	break;
    case 'seminar letter':
    	$form_action='temp.php';
    	break;
    case 'outreach postcard':
            $form_action='postcard.php';
    	break;
    default:
    $form_action = 'blah.php';
    }
    ?>
     <form action="<? echo $form_action; ?>" method="post" name="frmTemp" enctype="multipart/form-data" >
    Not seeing the rest of the code, I'm not sure. However, this would look alot better as a switch statement like above.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •