Hello and welcome to our community! Is this your first visit?
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
    Dec 2004
    Thanked 0 Times in 0 Posts

    how to identify that a form has been submitted using C/CGI

    if i use the GET method for the form in my HTML, my script works fine coz what i have is an IF statement..


    if (cgi_param("action"){

    then processing starts here



    this works coz cgi_param("action") (function is defined in another file [cgi.c])gets the value after "name" (name=action) in the URL that gets placed on the address bar when using the GET method. now the POST method does not show form values on the address bar. what's a good way of knowing that the user has submitted the form aside from the cgi_param() function i have above?

    im quite a newbie in server side programming so pls bear w/ me


  • #2
    Super Moderator
    Join Date
    May 2002
    Perth Australia
    Thanked 101 Times in 99 Posts
    well thats the standard way , check for a variable that the form had set , of course with GET anyone could have just typed that variable pair into the URL so you don't know if the request really is the result of a form , or if it is you don't know for sure it was even your form .

    I would use a session or cookie variable set in the form page & checked on the processing page to verify that the form data actually came from where it alledged to have come from , how you would go about that in C I have not a clue , cookies are just http headers , sessions a little more involved.
    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