Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Jul 2002
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    I don't want to show form after entring

    I would like to do that after entering my datas, I dont' want to show my form(texts) again. I jsut want to show" Thank you filling out my form" Also I would like to make a link to my Home.
    That's it.


    please tell me easy way to do my request

    Thank you

    Here is my code

    <html>

    <body>


    <?php
    $con = mysql_connect("localhost","itohideo","1234");


    if(!$con)
    {
    print("Fail DB Connection<br>\n");
    exit;
    }

    if(!mysql_select_db("itohideo"))
    {
    print("Fail DB Selection<br>\n");
    exit;
    }
    if (isset($_POST["submit"]))
    {
    $number = $_POST["number"];
    $name = $_POST["name"];
    $country = $_POST["country"];

    $query_insert = "insert into takao (number, name, country) values ('$number', '$name', '$country')";
    $query_result_insert = mysql_query($query_insert, $con) or die (mysql_error($con));

    echo "Thank you for filling out my form";

    mysql_close($con);

    }
    ?>

    <form method="post" action="<?php $_SERVER['PHP_SELF']; ?>">
    <P>please fill out this form and it goes to my database</P>
    Number<input name="number" type="text"><br>
    Name<input name="name" type="text"><br>
    You country<input name="country" type="text"><br>

    <input type="submit" name="submit">
    <input type="reset" name="reset">

    </form>
    </body>
    </html>

  • #2
    Super Moderator
    Join Date
    May 2002
    Location
    Perth Australia
    Posts
    4,040
    Thanks
    10
    Thanked 92 Times in 90 Posts
    PHP Code:
    <html> 
    <body> 
    <?php 
    $con 
    mysql_connect("localhost","itohideo","1234"); 
    if(!
    $con) { 
        print(
    "Fail DB Connection<br>\n"); 
        exit; 
        } 
    if(!
    mysql_select_db("itohideo")) { 
        print(
    "Fail DB Selection<br>\n"); 
        exit; 
        } 
    if (isset(
    $_POST["submit"])){ 
    $number $_POST["number"]; 
    $name $_POST["name"]; 
    $country $_POST["country"]; 
    $query_insert "insert into takao (number, name, country) values ('$number', '$name', '$country')"
    $query_result_insert mysql_query($query_insert$con) or die (mysql_error($con)); 
        if(
    mysql_insert_id()){
            
    $rets "Thank you for filling out my form"
        }
    mysql_close($con); 

    ?> 

    <?
    if($rets){
        echo 
    $rets;
    ?>
    <?
    }else{?>
        <form method="post" action="<?php $_SERVER['PHP_SELF']; ?>"> 
        <P>please fill out this form and it goes to my database</P> 
        Number<input name="number" type="text"><br> 
        Name<input name="name" type="text"><br> 
        You country<input name="country" type="text"><br> 
        <input type="submit" name="submit"> 
        <input type="reset" name="reset"> 
        </form> 
    <?}?>
    </body> 
    </html>
    resistance is...

    MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)


  •  

    Posting Permissions

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