Multiple submit buttons php different actions

后端 未结 4 1459
悲&欢浪女
悲&欢浪女 2020-11-30 05:56

I have a website started where I want to have 2 separate submit buttons, one of which will take data entered and do some calculations to it to display on the same screen. I\

4条回答
  •  情歌与酒
    2020-11-30 06:15

    Another approach is that You can create and Use some session variable to achieve it easily.

    E.g. $_SESSION['validate'].

    HTML and PHP Code for buttons

    
    
    

    jquery and ajax Script

    
    

    Handler PHP File

    ?>

    It may not be the optimal or efficient solution. My level of experience is not too much, so I came up with this solution what served my purpose best after all the solutions available but with their limitations. This was not anywhere so thought to write it here.

    Note: You may notice it includes some other parts like response, success and error handling between presentation, script and backend file.

    Hope it helps!

提交回复
热议问题