Jump to content

Memon

Members
  • Posts

    13
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Male
  • Location
    Tokyo

Memon's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thanks all for yr valuable advise.
  2. Thanks Rooput18. I will try with corrected code later. But just for yr info, the array consist of 40 to 50 'records', each of which has 10 'fields'. All fields are 'text' & not special characters are used. Just alpha-numerical characters. Short fields have 4 or 5 characters, whereas longest one has 25 characters. Do I need to use session for this purpose?
  3. Thanks for advise, Thrope. But still I would like to know what is problem with my coding. Secondly, I thought that session is suitable for storing only small data. OK, let me explain the use of this site. The first page reads the 'Stock List' from file & displays the list. But visitors can set some criteria/conditions, so only filtered data is displayed there. It is about 40 to 50 records. SOme details is displayed on this list. When visitor clicks the stock number of any single item, full details are shown on next page, with photos of that item. For that purpose, I am using stock number to be included in query string, & details page again read that record from stock list. This part is working fine. But user has to go back to original list, to see the details of different item. I need "Next" & "Previous" buttons on that details page, so that user can just see the next item of his filtered list, without going back. For that, I need to transfer the filtered stock list to "details.php" page. Pls guide me if there is any better way.
  4. I tried with serialize function, but still it is not going properly. I used this code in first page: $serial_array = serialize($my_array); echo "<A HREF='test.php?no=$item_no&my_array=$serial_array'>Item</A>"; In the next page (test.php), I used this code: $item_no=$_GET['no']; $my_array=unserialize($_GET['my_array']); But when I echo the "$my_array" array, it gives nothing. However, if I echo it without unserializing, it gives the long serialzied string.
  5. Normally we use a querry string to transfer variables. For instance; http://www.example.com/test.ph?var1=$var1&var2=$var2 If $var1 & $var2 are simple string variables, it is ok. But I want to pass some arrays to new page. Is it possible to pass thru querry string?
  6. Same code is now working fine. But rarely, it prints the whole text file on screen, instead of downloading. But running next time, again it works fine. Anyway, my problem is solved, as mostly it is working.
  7. OK. I removed all "echo"s. My Script is now like this. <?php $fp = "test.csv"; if(is_file($fp)) { // required for IE, otherwise Content-disposition is ignored if(ini_get('zlib.output_compression')) ini_set('zlib.output_compression', 'Off'); header("Pragma: public"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Content-Type: application/force-download"); header( "Content-Disposition: attachment; filename=".basename($fp)); header( "Content-Description: File Transfer"); readfile($fp); exit(); } ?> But now it outputs the whole CSV file on screen, instead of downloading it. Still some mistake in my code.
  8. Problem solved by using "%0A" instead of "\n" or "\r\n". Thanks all.
  9. For testing purpose. To see the result. Is that making problem?
  10. Thanks. I hv already tried it. Whether "\n" or "\r\n", in both cases browser gives error & mailclient does not popup. When removing this part, mail comes up, but body in single line.
  11. Hello All I am using a button in my script to send the email. It sends the email, but I can not set multiple lines in email body. My script is like this; $sub="Order for Item No:".$item_no; $body = $sub."./n Name: /n Tel No:"; echo "<input type='button' value='Order This Item' onClick=\"parent.location='mailto:[email protected]?subject=$sub&body=$body'\">"; I want "Item No" , "Name" & "Tel No" in separate lines in the mail body, but it all comes in a single line. Can someone guide me.
  12. I tried with that code, but it didn't work. Then I searched other sites & made some changes (special line for IE etc), but it still does not work. It gives 6 warnings (for each header line), saying; Warning: Cannot modify header information - headers already sent by (output started at D:\My Documents\My Webs\test.php:6) in D:\My Documents\My Webs\test.php on line 18 Then it gives following warning; Warning: readfile(stock.csv) [function.readfile]: failed to open stream: No such file or directory in D:\My Documents\My Webs\test.php on line 24 Can anybody guide me, where I am mistaking. My script is as follows; <?php $fp = "test.csv"; echo "<P ALIGN='CENTER'><font face='Arial Black' size='5' color='#0000FF'>File Name : $fp</FONT></P>"; // make sure it is a file before doing anything! if(is_file($fp)) { // required for IE, otherwise Content-disposition is ignored if(ini_get('zlib.output_compression')) ini_set('zlib.output_compression', 'Off'); header("Pragma: public"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Content-Type: application/force-download"); header( "Content-Disposition: attachment; filename=".basename($fp)); header( "Content-Description: File Transfer"); readfile($file); echo "<P ALIGN='CENTER'><font face='Arial Black' size='5' color='#00FF00'>SUCCSESS!</FONT></P>"; exit(); } else { echo "<P ALIGN='CENTER'><font face='Arial Black' size='5' color='#FF0000'>ERROR! NO SUCH FILE.</FONT></P>"; } ?>
  13. Hello All I want to put a link (or button) which makes possible to download the CSV file to local PC . Converting in excel format will be more useful, but not necessary.
×
×
  • 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.