Jump to content

bazazu

Members
  • Posts

    14
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

bazazu's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Is it coz of the radio buttons ??
  2. thanx a ton.. works great !! we get to eat the Cake just a small warning.. how do i make it go ?? Warning: fputcsv() expects parameter 2 to be array, boolean given in /home/faiz/public_html/bazazu.com/form/index3.php on line 232
  3. I made the changes and re entered the same data i did previously but still no luck.. have attached the output [attachment deleted by admin]
  4. after making the suggested changes and filling the form with data.. on first time filling the data i wrote in the text box on second time filling the data i wrote into text area and it did not change the output sequence for the better . have attached the output file [attachment deleted by admin]
  5. what if i take the textarea seperately.. is tht possible.. plz help me with ref to my example coding
  6. i actually am confused.. can someone please tell me how do i do it ?
  7. Assuming someone before you filled the form with all D's and nothing in text area, and you filled the form with all A's with Apple Cat Dog Done in the text area... then it should look like this attachment [attachment deleted by admin]
  8. my actual form has 300 X 4 radio buttons and a textarea.. writing onto the text area is optional people can write anything onto it. but when they press enter in the text area..and type LINE2 it gets saved onto the first column and you cant make out who entered what data. the data should look like this attachment .. sorry for not explaining it well earliar [attachment deleted by admin]
  9. i filled the form 5 times the first 3 times i did not write anything in the textbox the 4 th time i wrote and the 5th time i wrote The output that i got has been attached. you can also check it out at http://www.bazazu.com/form/info.csv [attachment deleted by admin]
  10. Hi Im sure am missing something very easy on this one can someone help me find it please.. INDEX.HTML <html> <head> <title>Example form</title> </head> <body> <form name="analysis" id="analysis" action="index3.php" method="POST"> <table width="70%"> <h5><strong>A=agree B=somewhat agree C=neutral D=disagree</strong></h5> <tr> <th align="left">SECTION 1</th> <td align="right">A B&nbsp C D </td> </tr> <tr class="question"> <td class="section">Love makes the world go round. <td align="right"> <input type="radio" name="love1" id="sec11" value="0"> <input type="radio" name="love1" id="sec11" value="2"> <input type="radio" name="love1" id="sec11" value="5"> <input type="radio" name="love1" id="sec11" value="10"> </tr> <tr class="question"> <td class="section">What goes around comes around <td align="right"> <input type="radio" name="love2" id="sec12" value="0"> <input type="radio" name="love2" id="sec12" value="2"> <input type="radio" name="love2" id="sec12" value="5"> <input type="radio" name="love2" id="sec12" value="10"> <tr class="question"> <td class="section">Love thy neighbor but dont get caught <td align="right"> <input type="radio" name="love3" id="sec13" value="0"> <input type="radio" name="love3" id="sec13" value="2"> <input type="radio" name="love3" id="sec13" value="5"> <input type="radio" name="love3" id="sec13" value="10"> <tr class="question"> <td class="section">youre a volcano and he/shes a tornado <td align="right"> <input type="radio" name="love4" id="sec14" value="0"> <input type="radio" name="love4" id="sec14" value="2"> <input type="radio" name="love4" id="sec14" value="5"> <input type="radio" name="love4" id="sec14" value="10"> </table> <p> <b> About you: </b> </p> <p> <textarea rows="5" name="addtext" cols="65"></textarea> </p> <div> <input type="submit" id="createcsv" name="createcsv"> </div> </form> </body> </html> INDEX3.PHP <?php // Receiving variables @$pfw_ip= $_SERVER['REMOTE_ADDR']; @$love1 = addslashes($_POST['love1']); @$love2 = addslashes($_POST['love2']); @$love3 = addslashes($_POST['love3']); @$love4 = addslashes($_POST['love4']); @$addtext = addslashes($_POST['addtext']); // Validation //saving record in a text file if ($_POST) { foreach ($_POST as $key => $value) { $_POST[$key] = addslashes($value); } $pfw_file_name = "info.csv"; // Let's store this as an array so we can loop through it $pfw_first_row = array("love1","love2","love3","love4","addtext"); if(!file_exists($pfw_file_name)) { $pfw_is_first_row = true; // If the file doesn't exist, let's create it if (!$fh = fopen($pfw_file_name, "w+")) { die("Cannot create file {$pfw_file_name}"); } else { fclose($fh); } } else { if (!$pfw_handle = fopen($pfw_file_name, 'r')) { die("Cannot open file ($pfw_file_name)"); } // If the file exists, we want to read in its contents else { // Until we reach the end of the file while (!feof($pfw_handle)) { // We'll read in one line at a time and store it in an array $existing_file[] = fgets($pfw_handle, 1024); } if (count($existing_file) == 1) { $pfw_is_first_row = true; } } // We only opened it for reading fclose($pfw_handle); } // Now we're going to open the file for writing if (!$pfw_handle = fopen($pfw_file_name, 'w+')) { die("Cannot open file {$pfw_file_name} for writing"); } else { // We need to write in the labels if ($pfw_is_first_row == true) { // Write the file one line at a time for ($i = 0; $i < count($pfw_first_row); $i++) { // We need to combine the first label and the first row of data $string = $pfw_first_row[$i] . "," . $_POST[$pfw_first_row[$i]] . "\r\n"; fwrite($pfw_handle, $string); } } else { // Same as above, except $existing_file contains labels plus whatever // was already in the file for ($i = 0; $i < count($existing_file); $i++) { $string = rtrim($existing_file[$i], "\r\n") . "," . $_POST[$pfw_first_row[$i]] . "\r\n"; fwrite($pfw_handle, $string); } } fclose($pfw_handle); } } echo("<p align='center'><font face='Arial' size='3' color='#FF0000'>thanx</font></p>"); ?> WHENEVER I WRITE SOMETHING IN THE about you BOX AND CLICK ENTER AND WRITE ONTO A NEW LINE.. THE DATA THAT GETS SAVED IN THE CSV GETS JUMBLED UP have uploaded the files at http://www.bazazu.com/form/ for your reference.. the link to the csv file once generated would be http://www.bazazu.com/form/info.csv please advice
  11. Mate i actually need them.. its just that am unable to get the data to come on the first row again after each form submission. its like Question Question Question Question Question and on submission and exporting to excel it should come as Question Answer Question Answer Question Answer Question Answer Question Answer or submission again or by another user Question Answer Answer Question Answer Answer Question Answer Answer Question Answer Answer Question Answer Answer
  12. Hi im desperately in need of some help here.. Im exporting my html page data to csv but i am unable to get the data onto a new column the code is as follows HTML FORM <form id="form1" name="form1" method="post" action="index.php"> <table class="formatTblClass"> <tr> <th colspan="6"><?=$message;?></th> </tr> <tr> <td width="68"><span>First Name</span></td> <td width="215"><input class="Name" type="text" name="fn" id="fn" /></td> <td width="62"><span>Last Name</span></td> <td colspan="3"><input class="Name" name="ln" type="text" id="ln" size="50" /></td> </tr> <tr> <td colspan="6"><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="71">Address</td> <td width="721"><input class="Address" name="address" type="text" id="address" size="100" /></td> </tr> </table></td> </tr> <tr> <td><span>City</span></td> <td><input class="City" type="text" name="city" id="city" /></td> <td><span>State</span></td> <td width="148"><input class="State" type="text" name="state" id="state" /></td> <td width="24"><span>ZIP</span></td> <td width="255"><input class="ZIP" type="text" name="zip" id="zip" /></td> </tr> <tr> <td><span>Phone</span></td> <td><input class="Phone" type="text" name="phone" id="phone" /></td> <td><span>Email</span></td> <td><input class="Email" type="text" name="email" id="email" /></td> <td><input name="emailMe" type="checkbox" id="emailMe" value="Yes" checked="checked" /></td> <td>Please send me email</td> </tr> <tr> <td colspan="6"><span>Comments <textarea name="comments" id="comments" cols="45" rows="5"></textarea> </span> <div align="center"> <input type="submit" name="Submit" id="Submit" value="Submit" /> <input type="reset" name="Reset" id="button" value="Reset" /> </div></td> </tr> </table> </form> <?php // Receiving variables @$pfw_ip= $_SERVER['REMOTE_ADDR']; @$fn = addslashes($_POST['fn']); @$ln = addslashes($_POST['ln']); @$address = addslashes($_POST['address']); @$city = addslashes($_POST['city']); @$state = addslashes($_POST['state']); @$zip = addslashes($_POST['zip']); @$phone = addslashes($_POST['phone']); @$email = addslashes($_POST['email']); @$emailMe = addslashes($_POST['emailMe']); @$comments = addslashes($_POST['comments']); // Validation //saving record in a text file $pfw_file_name = "formtest.csv"; $pfw_first_raw = "fn,\rln,\raddress,\rcity,\rstate,\rzip,\rphone,\remail,\remailMe,\rcomments\r\n"; $pfw_values = "$fn,\r$ln,\r$address,\r$city,\r$state,\r$zip,\r$phone,\r$email,\r$emailMe,\r".str_replace ("\r\n","<BR>",$comments )."\r\n"; $pfw_is_first_row = false; if(!file_exists($pfw_file_name)) { $pfw_is_first_row = true ; } if (!$pfw_handle = fopen($pfw_file_name, 'a+')) { die("Cannot open file ($pfw_file_name)"); exit; } if ($pfw_is_first_row) { if (fwrite($pfw_handle, $pfw_first_raw ) === FALSE) { die("Cannot write to file ($pfw_filename)"); exit; } } if (fwrite($pfw_handle, $pfw_values) === FALSE) { die("Cannot write to file ($pfw_filename)"); exit; } fclose($pfw_handle); echo("<p align='center'><font face='Arial' size='3' color='#FF0000'>thanx</font></p>"); ?> THIS IS THE OUTPUT I GET fn ln address city state zip phone email emailMe comments Tom Sawyer shady lane new york new york NY124 123456789 tom@sawyer.com Yes comments THIS IS THE OUTPUT I AM LOOKING FOR fn Tom Harry ln Sawyer Potter address shady lane magic lane city new york xyz state new york xyz zip NY124 12343 phone 123456789 987654321 email tom@sawyer.com harry@magic.co.uk emailMe Yes Yes comments comments this is the comment Plz help me on this one.. unable to get the script export the data in top to bottom columnwise format
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.