Form field submit
Results 1 to 9 of 9

Thread: Form field submit

  1. #1
    Banned
    Join Date
    Jun 2003
    Posts
    927

    Form field submit

    i was wondering over this submit button...i dont exactly know which file extention it has to be and does it have to be a database and be online or can you test it right offline?

  2. #2
    Webius Designerous Indiginous
    Join Date
    Mar 2002
    Location
    South Florida
    Posts
    1,123
    I'm not exactly sure what your refering to, but I believe it may be the "submit" button for an on-line form field.

    Take the following form:

    Code:
    <form action="name.php" method="post">
    Enter your name:<input type="text" maxlength="10" size="10" name="name">
    <input type="submit" value="Go for it!">
    </form>
    That form will make a variable called 'name' and place whatever you put into the input field into that variable. It will then send that variable to the action application, in this case name.php.

    Here is an example of name.php

    Code:
    <?php
    $name = $HTTP_POST_VARS['name'];
    
    echo $name;
    ?>

    This will echo ( or print) the value stored in the name variable from the form.

    Once you get more advanced you can actually combine the two codes into one php script and have it spit out the right responce depending on whether the submit button has been pressed yet or not.



    Hope that explains it a bit.

    xmad


    EDIT and Disclaimer: This app and form is very simple and has not done proper checking against buffer overflows and cross-site scripting. If you would like to see a very secure app, let me know and I will post it. This is done simply as a concept of the way a form submits information and is not meant to convey security in any way. haha

  3. #3
    Banned
    Join Date
    Jun 2003
    Posts
    927
    I dont exactly get this...i get the code and submit but i dont get for example like on forums...you post and it goes into a database, that is exactly what i want with an online form...i set the <form action="name.php" to filename.cgi or filename.asp or anything else but it won't save what i have submited...anyone help me out?

  4. #4
    You need a database installed with your server. There is code with php <?php ?> tags that connects to, say Mysql... In mysql you have tables, which store this data. Mysql can be managed by a tool like phpmyadmin. For forum software like phpbb2, you could have the setup of apache, php, and mysql.

    This is how I picked it up, then I got some books from the library. Neat-o stuff...
    http://hotwired.lycos.com/webmonkey/...tutorial4.html

  5. #5
    Junior Member
    Join Date
    Jun 2002
    Posts
    4
    You can use something like the following to test out a submit button:

    PHP Code:
    <?php
    if(isset($_POST['test'])){
    print(
    "You have clicked on the \"test\" button.");
    }

    elseif(!isset(
    $_POST['test')){
    print(
    "<form action=\"test.php\" action=\"post\"><input type=\"submit\" name=\"test\" value=\"test\">");
    }
    ?&
    gt

  6. #6
    Webius Designerous Indiginous
    Join Date
    Mar 2002
    Location
    South Florida
    Posts
    1,123
    Okay, A little bit more information is needed on what your trying to do.

    i was wondering over this submit button
    I'm thinking you mean the submit button that is associated with a form... yes? All that button does is takes the forms input, and sends it to the actions file. From there that file is responsible for dealing with the data.

    i dont exactly know which file extention it has to be
    That depends on what langiage the action file is written in. .php means it is a php program, asp means its a .NET asp program (VB.net or C#) .cgi means it a cgi script, etc etc...


    does it have to be a database and be online or can you test it right offline?
    To use a submit button, you don't need a database. But if you want to save the information submitted for future use, then yes, you should store it into a database. PHP does this nicely.



    You need to explain a bit more than these two/three line posts. Give a good explanation of what your trying to ask, then I can give you a better answer.

    xmad



    EDIT:


    I dont exactly get this...i get the code and submit but i dont get for example like on forums...you post and it goes into a database, that is exactly what i want with an online form...i set the <form action="name.php" to filename.cgi or filename.asp or anything else but it won't save what i have submited...anyone help me out?
    Just passing the form to a file will not save it into a database. You need to have that file name.php actually make a connection with a database, prepare the data to be stored in the database (addslashes etc), and then finally insert the data into the database. You need to program this all in that "name.php" file (or whatever you call it).

  7. #7
    Come to think of it.... you don't even need a database. You could write your scripts to save into text files, then pull the info from those textfiles. But I definetly wouldn't reccomend that for a forum, or something with passwords. Read up on include() in php

  8. #8
    Banned
    Join Date
    Jun 2003
    Posts
    927
    You need to explain a bit more than these two/three line posts. Give a good explanation of what your trying to ask, then I can give you a better answer.
    OK...here look, the website i am modifying or should i say making a whole new website based on the old one is http://www.flipbluechip.com
    ...on the portfolio updates is the form, yes it is a form with the submit button, the problem is i have not done online databases at all so i dunno what file extension to use and even how to set the whole form to database connection up

  9. #9
    Webius Designerous Indiginous
    Join Date
    Mar 2002
    Location
    South Florida
    Posts
    1,123
    As it stands now, that form submits the information to a cgi email script that emails the information to the address specified. In order to store this info in a database you need to create a database scructure to hold all the info. If you want to use PHP (my prefered method) then you need to learn how to create mySQL databases. Its really not that hard to learn the concept.

    You will need to make a php program that will accept all the input names into the php form, and take those variables and store it into the said database. Take a look at this thread for furthur information and hints on how to create a database and to call information from it.

    cheers,
    xmaddness

Posting Permissions

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