Results 1 to 4 of 4

Thread: <form action="insert.php" method="post">

  1. #1

    Thread Starter
    Fanatic Member damasterjo's Avatar
    Join Date
    Nov 2005
    Location
    In front of my Comp DirectX7 EXpert
    Posts
    827

    <form action="insert.php" method="post">

    can I make my page just go to a certain script on the same page after they click the button, like instead of going to insert.php, can I have like a sub on the page it calls to with the script? If so how, I am new to PHP...

    also how do you program a redirect? like it it did go to a confermation page or something, how would I make it return automatically?
    Software languages known:
    Qbasic - TI-Basic - Liberty Basic - Visual Basic 6
    Software API's known:
    Directx 7 and 8
    Internet languages, in the process of learning:
    HTML - JAVASCRIPT - PHP - CSS - MYSQL - AJAX

  2. #2
    <?="Moderator"?> john tindell's Avatar
    Join Date
    Jan 2002
    Location
    Brighton, UK
    Posts
    1,099

    Re: <form action="insert.php" method="post">

    to redirect a page use the header() function
    PHP Code:
    header('location: script.php'); 
    As for the other bit just use POST of GET variables that have been passed to the script
    PHP Code:
    if(isset($_GET['action']))
    {
        switch(
    $_GET['action'])
        {
            
    "func1":
                
    yourfunction_1();
            break;

            
    "func2":
                
    yourfunction_2();
            break;
        }


  3. #3

    Thread Starter
    Fanatic Member damasterjo's Avatar
    Join Date
    Nov 2005
    Location
    In front of my Comp DirectX7 EXpert
    Posts
    827

    Re: <form action="insert.php" method="post">

    Im sorry would you mind explaining this in alittle more detail please?
    Software languages known:
    Qbasic - TI-Basic - Liberty Basic - Visual Basic 6
    Software API's known:
    Directx 7 and 8
    Internet languages, in the process of learning:
    HTML - JAVASCRIPT - PHP - CSS - MYSQL - AJAX

  4. #4
    PowerPoster kfcSmitty's Avatar
    Join Date
    May 2005
    Posts
    2,222

    Re: <form action="insert.php" method="post">

    What John's code is doing, is it is checking if the variable being passed by $_GET has a value. With this code:

    Code:
    if (isset($_POST["variable"]))
    In your case, since you're passing by POST, you would use $_POST rather than $_GET.


    The Switch function reads the value of the POST and if its equal to 1 thing, it does function 1, otherwise, it does function2.


    HTH

Posting Permissions

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



Click Here to Expand Forum to Full Width