monit
+ Reply to Thread
Results 1 to 3 of 3

Thread: Help me with my first html form :-)

  1. #1
    Join Date
    Jan 2007
    Posts
    5

    Help me with my first html form :-)

    I've been trying and I think I'm just about there. Except I'm stuck.

    <
    Code:
    <form name="carpool" action="submit.php" method="post">
    
    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="el submito" />
    There is my form. When I click the submit button, It wants to download my submit.php file. Not what I want. I just watn to save the results to a text file on my computer.
    Here's my php file:
    Code:
    <?php
    $day = $_POST['day'];
    
    if(!$day) 
    {
        echo "Please submit some days";
        exit;
    }
    else
    {
        $filename = "carpool.txt"; 
        $content = "$day\n"; 
        $fp = fopen($filename, "a"); 
        $fw = fwrite( $fp, $content ); 
        fclose( $fp ); 
        
        if(!$fw) echo "You made a mistake, try again or ill kill you or something.";
        else echo "Successfully submitted.";
    }
    ?>

    I've also got a text file named carpool.txt



    Thanks for reading and extra thanks if you help.

  2. #2
    Join Date
    Jun 2006
    Posts
    459
    Try this
    Code:
    <?
    $filename = 'carpool.txt'; 
    $day = $_POST['day'];
    
    if (is_writable($filename)) 
    	{ 
    	if (!$handle = fopen($filename, 'a')) 
    		{ 
    		exit; 
    		} 
    	if (fwrite($handle, $day) === FALSE) 
    		{ 
    		exit; 
    		}
    	 fclose($handle); 
    } 
    ?>
    7h* L**7*57 c4n7 h4ck m*!
    Proud to have quit playing ®µÑȧ©ÅÞË

    If you write like a semi-literate boob you will very likely be ignored.
    Writing like a l**t script kiddie hax0r is the absolute l**t*st way to write!
    L0L

  3. #3
    Join Date
    Jan 2007
    Posts
    5
    I used that php scripty but it did the same thing as the last. I'l open the HTML, click on some options, and push the submit button and it asks me if I wan't to download my php file. Not exactly what I'm going for.

+ Reply to Thread

Similar Threads

  1. Need php form processor
    By sosme in forum Programming
    Replies: 6
    Last Post: 02-11-2008, 02:18 AM
  2. Email form !!! script
    By kompress0r in forum Programming
    Replies: 2
    Last Post: 04-05-2007, 08:47 PM
  3. HTML and its use....help
    By meisme in forum Internet Privacy
    Replies: 1
    Last Post: 03-01-2007, 02:58 PM
  4. html
    By jinx5720 in forum Security & Encryption
    Replies: 1
    Last Post: 01-29-2007, 03:24 PM
  5. Can anyone hack Robo Form?
    By nokluiswed in forum Internet Privacy
    Replies: 0
    Last Post: 08-23-2005, 09:29 AM

Posting Permissions

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