Single Form, many variables

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
deastwood
Forum Newbie
Posts: 2
Joined: Sun Nov 28, 2004 4:08 pm
Location: London, UK

Single Form, many variables

Post by deastwood »

I have a web page with a number of lists on it. This is simply a list of football teams - http://www.barfl.co.uk

What I want to do is have a single script for my contact form that uses the variable set by whatever team you select.
So I want the title of the form to be set with the variable of the team selected, and the email the form uses to be set by the same variable.

I am very new to PHP although I understand the basics, having hand scripted my web pages for well over 8 years (in HTML). Now using Dreamweaver, so I'm moving on ... :?

Any help would be appreciated

Donald
User avatar
thomas777neo
Forum Contributor
Posts: 214
Joined: Mon Mar 10, 2003 6:12 am
Location: Johannesburg,South Africa

Slightly Confusing

Post by thomas777neo »

The wording or explaination for your problem is rather vague.

However, did you want to to something like this:

Code: Select all

<form name="<? echo $team; ?>" method="post" action="">
This is a shot in the wind, please tell me if this is in any form of what you are trying to accomplish.
User avatar
phpScott
DevNet Resident
Posts: 1206
Joined: Wed Oct 09, 2002 6:51 pm
Location: Keele, U.K.

Post by phpScott »

close but what I think he wants is

Code: Select all

<title><?php echo $teamName; ?></title>
agian is that what you want.
User avatar
thomas777neo
Forum Contributor
Posts: 214
Joined: Mon Mar 10, 2003 6:12 am
Location: Johannesburg,South Africa

Post by thomas777neo »

So I want the title of the form to be set with the variable of the team selected
deastwood
Forum Newbie
Posts: 2
Joined: Sun Nov 28, 2004 4:08 pm
Location: London, UK

PHP Form variables

Post by deastwood »

Sorry for being vague, and I realise it is!
But on my front page I have list of say 20-odd teams. When the user selects a team, I want to load another page (enquiry.php) which takes parameters from the initial slection, in this case the team name, and use these parameters to use in the header of the form and also to use a specific email address in the PHP form.
So, I have form that loads and I want it to say London Lions Enquiry Form (not as the form TITLE but the actual text for the header of the form. And also, the email address the form uses needs to be selected depending on the team name.
If you look at http://www.barfl.co.uk and see the link for 'BARFL' on the main index page, when this is selected I use a form for equiries. If another team is selected, I want the text on the form to say "London Lions Enquiry Form" of "<teamname> Enquiry Form", and the email address within the PHP code to represent whatever team has been selected (will need a list of email addresses associated with different teams I assume?).

Does that help?

Donald
User avatar
thomas777neo
Forum Contributor
Posts: 214
Joined: Mon Mar 10, 2003 6:12 am
Location: Johannesburg,South Africa

Post by thomas777neo »

The same concept applies, wherever you want the name

Code: Select all

<?php
echo $name;
?>
. But I think it would be better for you to store the names in a database, with their respective email addresses. Then, if you select a team, send through the primary id so that you can retrieve the team name and email address.
Post Reply