ramki067 Posted October 31, 2007 Share Posted October 31, 2007 HI all, I've to develop a html page where when i click one or two checkboxes and click submit, it has to take the values from the checkboxes and search a file for these values and take the whole line where the value is obtained, and store that line in another file. Can anybody help me in this as i'm a newbie to HTML. Thanks and Regards, Ramki Quote Link to comment https://forums.phpfreaks.com/topic/75451-how-to-parse-a-file-from-checkbox-input/ Share on other sites More sharing options...
purefan Posted October 31, 2007 Share Posted October 31, 2007 First, learn php, then try to code your own thing. When you get a problem read the debug output from php, try to solve it, using google is a good idea. If google isnt able to help you, come to the forums with your code, but from now it does sound as if you are saying "I dont know anything and need to do this, please do it for me and I will say thank you" but there isnt a "quick fix" if you dont post a problem and if it doesnt look like you've been trying why should we? have a nice day Quote Link to comment https://forums.phpfreaks.com/topic/75451-how-to-parse-a-file-from-checkbox-input/#findComment-381713 Share on other sites More sharing options...
ramki067 Posted October 31, 2007 Author Share Posted October 31, 2007 no,no purefun, I didn't mention i didn't try it. I'm attaching my code below. I've been trying and now quite successful. But need some help on writing the contents on to a file.The file name i've mentioned is Selected_streams.txt, i need to write the searched contents to a file.Can u help me on this matter? <?php error_reporting(0); ini_set('display_errors', 1); ?> <HTML> <HEAD> <link href="style.css" type="text/css" rel="stylesheet" /> <TITLE>Streamware</TITLE> <script language="JavaScript"> var finalquery="" var conditionflag=false function goback() { location.href="automation.html" } </script> </HEAD> <BODY background=images/ltgray_lines1.gif text=000000> <center> <?php $streamname[0]=$_REQUEST['streamname1']; //echo "streamname1 is $streamname1";?> <br> <? $streamname[1]=$_REQUEST['streamname2']; //echo "streamname2 is $streamname2";?> <br> <? $streamname[2]=$_REQUEST['streamname3']; //echo "streamname3 is $streamname3";?> <br> <? $streamname[3]=$_REQUEST['streamname4']; //echo "streamname4 is $streamname4";?> <br> <? //---------The below code reads from the file and display the selected content--------------------// $i=0; $YourFile = "playback_automation_datafile_WMA_44kHz_full_2.txt"; $handle = fopen($YourFile, 'r'); while(!feof($handle)) { $Data = fgets($handle, 1024); //if(strpbrk($Data, '$streamname[i]')) if(strncmp($Data, $streamname[$i], strlen($streamname[$i])) != 0) { print $Data; [b]$File = "Selected_streams.txt"; $Handle1 = fopen($File, 'w'); echo "$Handle1"; fwrite($Handle1, $Data);[/b] } print "<p>"; $i++; } fclose($handle); fclose($Handle1); ?> <br><br> <form name="createquery" enctype="multipart/form-data" method="post" action="run.php"> <div id="container"> <div id="banner"> <div id="text"> </div> </div> <table border=0 cellpadding=4 cellspacing=1> <tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr> </td> <tr> <td valign=top align=left> </td> <td valign=top> <INPUT type="reset" value="Go Back" onclick="javascript:history.go(-1)"> </td> </tr> </TABLE> </FORM> </BODY> </HTML> Quote Link to comment https://forums.phpfreaks.com/topic/75451-how-to-parse-a-file-from-checkbox-input/#findComment-381736 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.