Jump to content

feed back after form


searls03

Recommended Posts

Ok, so what is happening is my form submits to this:

  <body>
    <?php
    // load Zend Gdata libraries
    require_once 'Zend/Loader.php';
    Zend_Loader::loadClass('Zend_Gdata_Spreadsheets');
    Zend_Loader::loadClass('Zend_Gdata_ClientLogin');

    // set credentials for ClientLogin authentication
    $user = "user";
    $pass = "password";

    try {
      // connect to API
      $service = Zend_Gdata_Spreadsheets::AUTH_SERVICE_NAME;
      $client = Zend_Gdata_ClientLogin::getHttpClient($user, $pass, $service);
      $service = new Zend_Gdata_Spreadsheets($client);

      // set target spreadsheet and worksheet
      $ssKey = 'ssKey';
      $wsKey = 'wsKey';

$name='Aaron Searls';
$item= "".$_POST['item']."".$_POST['item1']."";
      // create row content
      $row = array(
        "date" => date('m-d-y'), 
        "name" => $name, 
        "item" => $item,
        "paid" => 'yes'
      );

      // insert new row
      $entryResult = $service->insertRow($row, $ssKey, $wsKey);
     
      
    } catch (Exception $e) {
      die('ERROR: ' . $e->getMessage());
    }
    
echo $name;
echo $item;
    ?>
    <?php
echo 'aaron';
echo $item;
?>
  </body>
  
<html>

This is the form:

<form method="POST" name="myform<?php echo $id; ?>" id="myform<?php echo $id; ?>"> 
  <?php if ((strpos($val,'Sparring') || strpos($val,'Feet')) !== false){
    ?> 

        <input name="item" type="hidden" value="Sparring Feet Size: " />

  <select name="item1">
    <option idue="Child 12/13">Child 12/13</option>
    <option value="1/2">1/2</option>
    <option value="3/4">3/4</option>
    <option value="5/6">5/6</option>
    <option value="7/8">7/8</option>
    <option value="9/10">9/10</option>
    <option value="11/12">11/12</option>
    <option value="13/14">13/14</option>
  </select>

  <?php } else if ((strpos($val,'Sparring') || strpos($val,'Hands')) !== false){
    ?> 

    <input name="item" type="hidden" value="Sparring Hands...shoe size: " />
please enter shoe size(hands are based on shoe size) <input name="item1" type="text" />

  <?php } else if ((strpos($val,'Sparring') || strpos($val,'Shins')) !== false){
    ?> 

    <input name="item" type="hidden" value="Sparring shins...shoe size:" />
  please enter shoe size(shins are based on shoe size) <input name="item1" type="text" />
  <?php } else if ((strpos($val,'Sparring') || strpos($val,'head')) !== false){
    ?> 

    <input name="item" type="hidden" value="Sparring Head: size" />
    please keep in mind most people are XL
  <select name="item1">
    <option value="Small">Small</option>
    <option value="Medium">Medium/Lg</option>
    <option value="Large">X-Large</option>
  </select>
  <?php } else if ((strpos($val,'Sparring') || strpos($val,'Elbow Pads')) !== false){
    ?>


    <input name="item" type="hidden" value="elbow pads" />
  <?php } else if ((strpos($val,'Sparring') || strpos($val,'Groin Protector')) !== false){
    ?> 

<input name="item" type="hidden" value="Groin protector size: " />
  <select name="item1">
    <option value='Child Cup Sm (20"-26")'>Child Cup Sm (20"-26")</option>
    <option value='Child Cup Lrg (26"-32")'>Child Cup Lrg (26"-32")</option>
    <option value='Adult Small (26"-32")'>Adult Small (26"-32")</option>
    <option value='Adult Medium (32"-38")'>Adult Medium (32"-38")</option>
    <option value='Adult Large (38"-44")'>Adult Large (38"-44")</option>
    <option value='Adult X-Large (44"-50")'>Adult X-Large (44"-50")</option>
  </select>

  <?php } else if ($val=='Sparring/Ecas Gear:ECAS Gear'){
    ?> 

    <input name="item" type="hidden" value="Ecas Gear size " />

    Shin/elbow
  <select name="shin/elbow">
    <option value="Small">Small</option>
    <option value="Medium">Medium</option>
    <option value="Large">Large</option>
    <option value="X-Large">X-Large</option>
  </select> Shin/elbow
  <select name="glove">
    <option value="Sm/Med">Sm/Med</option>
    <option value="Lg/Xl">Lg/Xl</option>

  </select>
   
  <?php }
  ?>
  <input type="submit" name="hellobob"  value="Submit" />

</form>

 

The code submits to ajax without a page refresh. 

After it submits to the ajax which submits to the first code, I want the submit button and the form field to turn into a message saying submitted.  How do I do this?  does this make sense?

Link to comment
Share on other sites

Hi Mate

 

Probably easiest if done with jquery. Something like:

 

  <script>
  $(document).ready(function () {
  

$("#FormSubmitButtonID").click(function(){

		// Logic to determine the form is ok to submit. 

	$('#YourFormID').hide();

	$("#YourThankYouMessageDivID").show(2000);



  });
  
    
});


  </script>

 

Tapping that in off the top of my head, and i always typo javascript, but it is a simplistic example of what you want.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.