470,833 Members | 1,352 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,833 developers. It's quick & easy.

Hold value

I have a web form to collect player data from team leaders.

Problem 1

Each team leader may enter individual data for any ammount of others. Each
time the form is submitted I am clearing the field which also clears the
team leader's name. What I want is a way of holding the initial field (team
leaders name) whilst in session. I think I can do this with a php variable.
Cant quite grasp the syntax

Problem 2
On submit I intend sending the data to my email address and to a mysql
database. Whats a simple way for me to get the mysql database to email me a
csv file from the database? Can I do this with PHP code from the website

Garry Jones
Sweden


Apr 10 '06 #1
2 1788
Garry Jones wrote:
I have a web form to collect player data from team leaders.
Hi Garry,

Problem 1

Each team leader may enter individual data for any ammount of others. Each
time the form is submitted I am clearing the field which also clears the
team leader's name. What I want is a way of holding the initial field
(team leaders name) whilst in session. I think I can do this with a php
variable. Cant quite grasp the syntax
From the receiving script (= the script named in the action of the form) you
can retrieve a POST value as follows:
$teamname = $_POST["teamname"];

If you want to 'recyle' that name, just give it as a value to the
corresponding formfield:
<input type="text" name="teamname" value="<?= $teamname ?>">

If you need to pass around a variable from script to next script, you can
use a session.

It is all here:
http://nl2.php.net/manual/en/ref.session.php

In short:
- put a variable in a session:
$_SESSION["teamname"] = $teamname;

from another script:
$_SESSION["teamname"] now contains the value you put into it.

Problem 2
On submit I intend sending the data to my email address and to a mysql
database. Whats a simple way for me to get the mysql database to email me
a csv file from the database? Can I do this with PHP code from the website
That are two different thing.
I suggest that your receiving script first does a database insert, and then
mails the results (as csv or whatever suits you) to your mainadress.
Look up at www.php.net the mail function.

Regards,
Erwin Moller

Garry Jones
Sweden


Apr 11 '06 #2
> Problem 2
On submit I intend sending the data to my email address and to a mysql
database. Whats a simple way for me to get the mysql database to email me
a csv file from the database? Can I do this with PHP code from the website


This is reasonably straightforward code. I would suggest that you could
same time by installing phpMyAdmin and have that produce the csv.

Apr 13 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Julia Baresch | last post: by
3 posts views Thread by vtxr1300 | last post: by
2 posts views Thread by Patrick | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.