How To Post Information from a Form in PHP.

Discussion in 'PHP' started by netmaster123, Jun 12, 2007.

  1. #1
    After creating a short form in php how do I go about uploading the information to a file in my server and then creating a html file out of it and publishing on line.

    For example in this form:

     <form action="process.php" method="post">
          <input type="text" name="thebox" value="name" size="20"><p>
          
          <textarea name="message" rows="7" cols="22">
    Please write your message here.
    </textarea>
    
    <p>
    <input type="submit" value="Submit">
    
    <p>
    <form action="process.php" method="post">
    Form elements and formatting etc.
    </form>
    PHP:
    how do I get the information stored in process.php and generate a new html file with the:

    1. text are name & text area message.

    I am building a small classified script and I need some help, it has got to be very simple. you fill out the information in the form and it will generate a html file with the information that you entered in the form then the new classified will be posted in the main page of my site.

    Thanks guys for your help in advance!
     
    netmaster123, Jun 12, 2007 IP
  2. coderbari

    coderbari Well-Known Member

    Messages:
    3,168
    Likes Received:
    193
    Best Answers:
    0
    Trophy Points:
    135
    #2
    you will get the values in process.php from $_POST['thebox'],$_POST['message']
     
    coderbari, Jun 12, 2007 IP
  3. jestep

    jestep Prominent Member

    Messages:
    3,659
    Likes Received:
    215
    Best Answers:
    19
    Trophy Points:
    330
    #3
    If you make a script like this, you need to use some very good cleaning of whatever input the user puts into the message input field. If you straight create a file with that input without thoroughly removing any potentially dangerous script, anyone could create a page with whatever php script they want in it and easily gain access to your server. Also, for the script to create files, there has to be fairly open permissions on the folder that the files are being created in, which is another security concern in itself.

    You would be better off adding the information to a database, and then pulling the information out of the database as needed.
     
    jestep, Jun 12, 2007 IP