Hey, intermediate php/mysql user here. I have a mailing list form on
my website, what i'd ultimately like to happen is when the user
submits their information that all goes into the database. The tricky
part is i'd like it so for my clients, they can go to an admin utility
and press an "export" button and have it spit out the data from that
form, into either an excel doc or a csv, whatever is easiest... any
suggestions on how to do this?
Truck 6 1290
Truck Estevez <oo******@gmail.comwrites:
Hey, intermediate php/mysql user here. I have a mailing list form on
my website, what i'd ultimately like to happen is when the user
submits their information that all goes into the database. The tricky
part is i'd like it so for my clients, they can go to an admin utility
and press an "export" button and have it spit out the data from that
form, into either an excel doc or a csv, whatever is easiest... any
suggestions on how to do this?
Truck
Hi Truck,
This should be quite simple if you go with csv.
Basically, you just send to content of your document
to the client just like you would a webpage, the key
is setting the correct headers so that the browser
knows what to do with it.
Take a look at the php docs for the header() function. http://php.net/header
I think you'll want to start by setting the "content-type",
"content-length" and "content-disposition". You may also
need to set others depending on the browser.
Hope that helps,
Carl.
Truck Estevez wrote:
Hey, intermediate php/mysql user here. I have a mailing list form on
my website, what i'd ultimately like to happen is when the user
submits their information that all goes into the database. The tricky
part is i'd like it so for my clients, they can go to an admin utility
and press an "export" button and have it spit out the data from that
form, into either an excel doc or a csv, whatever is easiest... any
suggestions on how to do this?
Truck
Truck,
As Carl indicate, CSV should be quite easy.
However - I'd advise against this. People signed up to receive mail
from YOUR site. Suddenly getting mail from other sites would probably
be reported as spam - and you're client would be very upset if he got
labeled as a spammer for using your mailing list.
And there's no recourse. Yes, this is an opt-in mailing list (double
opt-in, I hope!). But the opt-in was not to receive mail from anyone
you sell your list to.
It will also get you in trouble with people who signed up on your opt-in
list.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp. js*******@attglobal.net
==================
Jerry Stuckle wrote:
However - I'd advise against this. People signed up to receive mail
from YOUR site. Suddenly getting mail from other sites would probably
be reported as spam - and you're client would be very upset if he got
labeled as a spammer for using your mailing list.
I'd assumed that when the OP referred to "my website" he meant, "the
website I'm building for my client". Though I could be wrong.
--
Toby A Inkster BSc (Hons) ARCS
[Geek of HTML/SQL/Perl/PHP/Python/Apache/Linux]
[OS: Linux 2.6.12-12mdksmp, up 88 days, 14:20.]
The Great Wi-Fi Controversy http://tobyinkster.co.uk/blog/2007/05/22/wifi-scare/
Toby A Inkster wrote:
Jerry Stuckle wrote:
>However - I'd advise against this. People signed up to receive mail from YOUR site. Suddenly getting mail from other sites would probably be reported as spam - and you're client would be very upset if he got labeled as a spammer for using your mailing list.
I'd assumed that when the OP referred to "my website" he meant, "the
website I'm building for my client". Though I could be wrong.
Hi, Toby,
That could be. I'm going on his wording - he mentioned "my website" and
"my clients" in a way which looked to me to be referring to two
different things. But I could be wrong, also.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp. js*******@attglobal.net
==================
I actually meant it solely for the client and no one else... moving on
though, I did find an export to excel script but i'm having one
problem: the php displays all the data fine in text form, but a file
download prompt is also supposed to pop up and this isn't happening.
Any ideas why?
Here's the code:
<?php
$user="user";
$host="localhost";
$password="pass";
$database = "db";
$connection = mysql_connect($host,$user,$password)
or die ("couldn't connect to server");
if ($db = mysql_select_db($database,$connection))
echo"connection successful";
if (check_valid_user_admin())
{
$select = "SELECT * FROM mailinglist";
$export = mysql_query($select);
$fields = mysql_num_fields($export);
while($row = mysql_fetch_row($export)) {
$line = '';
foreach($row as $value)
{
if ((!isset($value)) OR ($value == "")) {
$value = "\t";
} else {
$value = str_replace('"', '""', $value);
$value = '"' . $value . '"' . "\t";
}
$line .= $value;
}
$data .= trim($line)."\n";
}
$data = str_replace("\are","",$data);
if ($data == "") {
$data = "\n(0) Records Found!\n";
}
header("Content-type: application/x-msdownload");
header("Content-Disposition: attachment; filename=dorado.xls");
header("Pragma: no-cache");
header("Expires: 0");
print "$header\n$data";
?>
Like I said, it displays the data fine, just no download prompt which
is a bummer. Any ideas?
Truck
Truck Estevez wrote:
I actually meant it solely for the client and no one else... moving on
though, I did find an export to excel script but i'm having one
problem: the php displays all the data fine in text form, but a file
download prompt is also supposed to pop up and this isn't happening.
Any ideas why?
Here's the code:
OK, glad it's for only this client.
You don't get the popup because you have your browser set up to handle
the application/x-msdownload by default. There isn't anything you can
do about browser settings from the server end.
<snip>
>
Like I said, it displays the data fine, just no download prompt which
is a bummer. Any ideas?
Truck
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp. js*******@attglobal.net
================== This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Ryan Thompson |
last post by:
Hello,
I'd like to receive input on your opinions regarding creating a stanardized
exportable report format. We primarily work in VB and ASP and will be
moving to ASP.net later this year.
...
|
by: Dan Nash |
last post by:
Hi guys
I wonder if you could help. I'm trying to create a bespoke interface for
mail merging from an Access database in Word. At the moment, I'm just trying
it with CSV files, and it works....
|
by: Megan |
last post by:
Hi everybody-
I'm helping a friend with a music database. She has an old one and is
creating a new one. She wants to compare records and fields in the old
database with records and fields in the...
|
by: Gaz |
last post by:
Hi all
I am currently trying to send and email via exchange except I'm having a
nightmare getting it working, you'd think this would be pertty simple
wouldn't you?
I have added a reference to...
|
by: VB Programmer |
last post by:
I have a database with customers. I aslo have a simple HTML newsletter:
Hello !
Your address is , , .
You work for .
Here is your logo: .
I want to let the user:
1. Edit the newsletter in...
| |
by: MMAS |
last post by:
I've got my .net application set up to use gmail as a mail server (see
code below). Everything works quite well, actually, EXCEPT for one
particular email account. I've created an "admin" account...
|
by: Dave |
last post by:
Hi,
When you create buttons from the wizard you can go on report options
and select mail report. This sends a report in a chosen format to the
mail software as an attachment.
There are two...
|
by: maxxxxel |
last post by:
Hi
Can anyone help me with some asp code , I changed the code to use CDO.message instead of the old cdont.sys to send mail from a ASP webpage which works fine.
Our problem is that when we send...
|
by: tdw |
last post by:
Hi all,
I am trying to create an Access database for use purely as a more efficient way to enter fields into a Mail Merge for a friend who is an attorney.
Currently, I am using Word's mail...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |