Results 1 to 12 of 12

Thread: CGI

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Dec 2000
    Posts
    135


    hi i need a cgi script that will take 5 values submitted by a form and out them on one line serperated by commas in a text file like this

    value1,value2,value3,value4,value5
    value1,value2,value3,value4,value5
    value1,value2,value3,value4,value5

    and if if "value1" already exists in the text file then it replaces that line with the line being submitted! thanx

    ps i have no idea how to install a cgi so please tellme as well


  2. #2
    Fanatic Member
    Join Date
    Aug 2000
    Posts
    879

    hey

    u can atleast say something
    Visual Basic 6.0
    Visual C++ 5
    Delphi 5


  3. #3
    Guest
    Ok, first of all... what CGI language??

    the most common is perl, but there is also C,C++, Python, etc..


    you can also use other server side languages like PHP(my favorite), ASP, or ColdFusion.

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Dec 2000
    Posts
    135

    sorry

    i have no idea what im saying but i want some sort of script that will do what my 1st post says i dont know a single thing about perl and stuff but i am going to learn it once im finished with vb!!

  5. #5
    Guest
    but what language do you want it in?
    Perl?

  6. #6
    Fanatic Member
    Join Date
    Aug 2000
    Posts
    879
    sure
    Visual Basic 6.0
    Visual C++ 5
    Delphi 5


  7. #7
    Fanatic Member
    Join Date
    Aug 2000
    Posts
    879
    which ever u can do it is appreciated
    Visual Basic 6.0
    Visual C++ 5
    Delphi 5


  8. #8
    Guest
    since I know and love PHP (), I will do it in that.
    here is the page with the form:

    Code:
    <!-- form.htm -->
    <HTML>
     <BODY>
      <FORM ACTION="dostuff.php" METHOD="POST">
       <INPUT TYPE="TEXT" NAME="V1"> <BR>
       <INPUT TYPE="TEXT" NAME="V2"> <BR>
       <INPUT TYPE="TEXT" NAME="V3"> <BR>
       <INPUT TYPE="TEXT" NAME="V4"> <BR>
       <INPUT TYPE="TEXT" NAME="V5"> <BR>
       <INPUT TYPE="SUBMIT">
      </FORM>
     </BODY>
    </HTML>
    here is the php page:

    Code:
    <!-- dostuff.php -->
    <HTML>
     <BODY>
      <?php
       function writetolog($logfile, $texttowrite) 
       {
        $filenum = fopen($logfile,"a");
        fwrite($filenum,$texttowrite);
        fclose($filenum);
       }
    
       $str = ""; //make sure $str is empty
       if (isset($V1)) $str .= "$V1,"; //if it's set, add it
       else $str .= "value1,"; //if not, then do default
     
       if (isset($V2)) $str .= "$V2,";
       else $str .= "value2,";
     
       if (isset($V3)) $str .= "$V3,";
       else $str .= "value3,";
     
       if (isset($V4)) $str .= "$V4,";
       else $str .= "value4,";
     
       if (isset($V5)) $str .= "$V5";
       else $str .= "value5";
    
       $str .= "\r\n"; //new line characters.
       writetolog("val.txt", $str); //append to file
      ?>
     </BODY>
    </HTML>

    to use this code, you have to have PHP installed on the machine you are trying to run it on.

  9. #9
    Fanatic Member
    Join Date
    Aug 2000
    Posts
    879
    is php on everyones computer? cuz i need a script that is compatible wiht alot of computers, cuz i dont think my visitiors would have php.
    Visual Basic 6.0
    Visual C++ 5
    Delphi 5


  10. #10
    Fanatic Member
    Join Date
    Aug 2000
    Posts
    879

    oh yes

    i think your code checks for every variable if its in the txt file but i only want it to check the 1st variable!
    Visual Basic 6.0
    Visual C++ 5
    Delphi 5


  11. #11
    Hyperactive Member CyberSurfer's Avatar
    Join Date
    Aug 2000
    Location
    Old London Town
    Posts
    425
    PHP only needs to be installed on the Server where the script is stored (IE uklinux.net's server). The script is executed on the server, and the results are sent to your visitors computer as an ordinary HTML file. If your current host doesn't support PHP, try http://www.cfm-resources.com for some kick ass free hosting!

  12. #12

    Thread Starter
    Addicted Member
    Join Date
    Dec 2000
    Posts
    135

    the way it workes

    this is how it workes plese help me anything is apreachiated!!

    lets say the 1st value is the name of a person
    the 2nd value is the age fo a person and the third is the sex of the person
    i want the script to search for the name only and if it findes the name then it replaces that line with the one beaing submitted

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