SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Nov 2004
    Location
    Finland
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    help please with this form broblem

    help please with this form broblem
    ________________________________________
    Hello all

    I have the following form

    <FORM METHOD="POST" ACTION="">
    <input name="checkbox" type="checkbox" value="checkbox" checked>
    test1
    <input name="checkbox2" type="checkbox" value="checkbox" checked>
    test2
    <INPUT NAME="name" TYPE=text id="name">
    <INPUT NAME="email" TYPE=text id="email">
    <INPUT NAME="city" TYPE=text id="city">
    <INPUT name="submit" TYPE=submit id="Submt" VALUE="submit;">


    which contains two checkboxes and other information, the problem I want to store the values entered by the user in three different text file.

    1- If the user chose the first checkbox and enter his/her information the code will store the values to text a.

    2- If the user chose the second checkbox and enter his/her information the code will store the values to text b.

    3- If the user chose the two checkboxes (test1 and test2) and enter his/her information the code will store the values to text c.

    I am new in PHP, could please helping me to solve this problem, which I have spent three days to solve it without any result.

    Thank you in advance

  2. #2
    SitePoint Member stewarty's Avatar
    Join Date
    Oct 2004
    Location
    Ireland
    Posts
    21
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    try this (you may also need to set the action in that form)

    PHP Code:
    if( isset($_POST['checkbox'])){
    //staff to add to text a
    }
    if( isset(
    $_POST['checkbox2'])){
    //staff to add to text b
    }
    if( isset(
    $_POST['checkbox2'])) AND (isset($_POST['checkbox'])){
    //staff to add to text c

    I don't know how to store to text files, only ever use mysql so i'll leave that to some one else, and you might want to addslashes() those $_POST values, just incase.

  3. #3
    SitePoint Member
    Join Date
    Nov 2004
    Location
    Finland
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you stewarty, I will try this


    Greetings


Bookmarks

Posting Permissions

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