Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. How can I submit with 1 button and 1 form with 2 actions?

How can I submit with 1 button and 1 form with 2 actions?

Scheduled Pinned Locked Moved Web Development
databasequestionjavascriptphpmysql
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    amitb2
    wrote on last edited by
    #1

    I have 2 pages. 1st is the index.php that have 3 fields. 2 of them should saved to sql and its works fine and the 3rd one should pass the value to 2nd screen. I have JS file. I success doing these 2 operations successfuly but in seperated projects. When I am trying to make them together there are mistakes. I want to know How can I implement those 2 parts together please. index.php

    PHP MySQL Insert Tutorial
        
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
            
    Insert
    

    2nd.php

    minus

    jS

    $('#myform').submit(function(){
    return false;
    });

    $('#insert').click(function(){
    $.post(
    $('#myform').attr('action'),
    $('#myform :input').serializeArray(),
    function(result){
    $('#result').php(result);
    }
    );
    });

    W 1 Reply Last reply
    0
    • A amitb2

      I have 2 pages. 1st is the index.php that have 3 fields. 2 of them should saved to sql and its works fine and the 3rd one should pass the value to 2nd screen. I have JS file. I success doing these 2 operations successfuly but in seperated projects. When I am trying to make them together there are mistakes. I want to know How can I implement those 2 parts together please. index.php

      PHP MySQL Insert Tutorial
          
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
              
      Insert
      

      2nd.php

      minus

      jS

      $('#myform').submit(function(){
      return false;
      });

      $('#insert').click(function(){
      $.post(
      $('#myform').attr('action'),
      $('#myform :input').serializeArray(),
      function(result){
      $('#result').php(result);
      }
      );
      });

      W Offline
      W Offline
      W Balboos GHB
      wrote on last edited by
      #2

      One thing I see right away: your 2nd.php form submit's to index.php but the values you pass from the form are never looked for in index.php. So what's the point of that interaction?

      Ravings en masse^

      "The difference between genius and stupidity is that genius has its limits." - Albert Einstein

      "If you are searching for perfection in others, then you seek disappointment. If you seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups