Jump to content

how to save inquiry form in csv


pixeltrace

Recommended Posts

hi,

 

i need help. i have a project wherein inquiries must be logged in a csv form.

my problem is i have no idea how to do it.

 

sample page is this

http://mango.resonance.com.sg/memoryworld/index.php?option=com_warranty

 

hope you could help me with this.

 

thanks!

Link to comment
Share on other sites

Writing an example right now.. will edit post with results

 

Normally I would build form results in to an object and do this a bit different, but a simple way of doing it is as follows:

 

<?php
/**
* @author: nick stinemates
*/

function array_to_csv($array) {
/**
 * in array,
 * out csv list
 * 
 * i.e $x = array_to_csv(array("apple", "orange"));
 */

$ret = "";

foreach ($array as $val) {
	$ret .= $val . ",";	
}	
return $ret;
}

$date = $_POST['date'];
$name = $_POST['name'];

.
.
.
.

$arr = array($date, $name, $nVal);

$fh = fopen("some.file", "w+");
fwrite($fh,array_to_csv($arr));

?>

Link to comment
Share on other sites

hi,

 

what i mean is each values taken from the form must be separated in columns.

 

let say i have column

 

brand, product  model, product type, serial no, warranty period....... so on.

 

if the form is submitted, how can i save it on the csv that

the value for brand name, product model, product type,....... will be inserted

in there respective columns?

 

 

hope you could help me with this.

 

thanks!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.