Help me finish my html form with PHP

Discussion in 'PHP' started by Roar!, Feb 2, 2007.

  1. #1
    Okay, so I'm very new to php, im only familiar with java and html. I want to create a simple form that will send the data to me via email or save to a file. whiever is easiest. The data can be kept public doesn't matter. Here is my attempt:



    HMTL:
    
    <form name="carpool" action="submit.php" method="post">
    <input name="day" type="text" value="Enter your name here" size="18" maxlength="100"><p></p>
    Check the days that you are able to drive <b>TO</b> rowing.<p>
    
    <LABEL><INPUT TYPE="checkbox" NAME="day" VALUE="Monday"> Monday</LABEL>
    <LABEL><INPUT TYPE="checkbox" NAME="day" VALUE="Tuesday"> Tuesday</LABEL>
    <LABEL><INPUT TYPE="checkbox" NAME="day" VALUE="Thursday">Thursday</LABEL>
    <LABEL><INPUT TYPE="checkbox" NAME="day" VALUE="Friday">Friday</LABEL>
    <LABEL><INPUT TYPE="checkbox" NAME="day" VALUE="Saturday">Saturday</LABEL>
    </p>
    Check the days that you are able to drive <b>FROM</b> rowing.<p>
    <LABEL><INPUT TYPE="checkbox" NAME="day" VALUE="Monday"> Monday</LABEL>
    <LABEL><INPUT TYPE="checkbox" NAME="day" VALUE="Tuesday"> Tuesday</LABEL>
    <LABEL><INPUT TYPE="checkbox" NAME="day" VALUE="Thursday">Thursday</LABEL>
    <LABEL><INPUT TYPE="checkbox" NAME="day" VALUE="Friday">Friday</LABEL>
    <LABEL><INPUT TYPE="checkbox" NAME="day" VALUE="Saturday">Saturday</LABEL>
    </p>
    <input type="submit" name="submit" value="Submit" />
    
    
    
    </FORM>
    Code (markup):
    Here is the other phile:
    <?
    $filename = 'carpool.txt'; 
    $day = $_POST['day'];
    
    if (is_writable($filename)) 
    	{ 
    	if (!$handle = fopen($filename, 'a')) 
    		{ 
    		exit; 
    		} 
    	if (fwrite($handle, $day) === FALSE) 
    		{ 
    		exit; 
    		}
    	 fclose($handle); 
    } 
    ?>
    Code (markup):


    I really don't have any clue how to use this. I just have my thre files sitting in a folder and When I try to submit on my form, it asks me if I want to download my submit.php file. Not exactly what I'm going for.
    thanks for reading and extra thanks if you help.
    my AIM is roarthing2112 if it's easier there.
     
    Roar!, Feb 2, 2007 IP
  2. sharpweb

    sharpweb Guest

    Messages:
    246
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Sounds like you don't have php installed. Your server doesn't know how to run a .php file. You should fix that first.
     
    sharpweb, Feb 2, 2007 IP
  3. nirghum

    nirghum Banned

    Messages:
    44
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    yes, thats the problem, you should ask your host to install php. If there is a php interpretor, it shouldn't tell you to download some files which ends with .php
     
    nirghum, Feb 3, 2007 IP
  4. pixel_perfect

    pixel_perfect Banned

    Messages:
    238
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #4
    or he might be useing the windows hosting?
     
    pixel_perfect, Feb 3, 2007 IP
  5. Roar!

    Roar! Guest

    Messages:
    11
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Ok, I can do that when I get back to my own computer. How does my code look?
     
    Roar!, Feb 3, 2007 IP
  6. pixel_perfect

    pixel_perfect Banned

    Messages:
    238
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #6
    what do you mean by?
     
    pixel_perfect, Feb 3, 2007 IP
  7. Roar!

    Roar! Guest

    Messages:
    11
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Well I really don't know anything about php, I basically pulled this code from a website and edited the variables until they looked right to me. Should what I posted execute correctly?
     
    Roar!, Feb 3, 2007 IP
  8. Roar!

    Roar! Guest

    Messages:
    11
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Right now I'm just trying to run it on my computer.
     
    Roar!, Feb 3, 2007 IP
  9. slayer

    slayer Well-Known Member

    Messages:
    1,926
    Likes Received:
    85
    Best Answers:
    0
    Trophy Points:
    165
    #9
    you can't run php scripts just like that on your pc
    download and install XAMPP, put your file in htdocs folder and acces your php file like this: http://localhost/(php file name goes here)
     
    slayer, Feb 3, 2007 IP
  10. pixel_perfect

    pixel_perfect Banned

    Messages:
    238
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #10
    if you dont know how does it look like then .. you can open it in Dreamweaver or attache here will upload some here or you can try some free hosting service to test it.
     
    pixel_perfect, Feb 3, 2007 IP
  11. baddot

    baddot Active Member

    Messages:
    309
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    58
    #11
    or you can try a simple with out xampp just install the apache server and see at www.apache.com and do a info list on php
     
    baddot, Feb 3, 2007 IP
  12. Roar!

    Roar! Guest

    Messages:
    11
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #12
    Okay, I got all the files up.

    hbra-ahs.your-websites.net/

    username: carpool
    password: myspace518

    a "?" appears next to the php file so I think it may not be supported. Any idears?
     
    Roar!, Feb 3, 2007 IP
  13. pixel_perfect

    pixel_perfect Banned

    Messages:
    238
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #13
    i think its supported there... and it showing blank that may be there is an error in the file.

    ? is something with document symbol.
     
    pixel_perfect, Feb 4, 2007 IP
  14. Roar!

    Roar! Guest

    Messages:
    11
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #14
    That's why I posted in php, I wanted you guys to check my programming skillz
     
    Roar!, Feb 4, 2007 IP
  15. pixel_perfect

    pixel_perfect Banned

    Messages:
    238
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #15
    pixel_perfect, Feb 5, 2007 IP