Multiple form on one page

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
creatco
Forum Newbie
Posts: 2
Joined: Sun Mar 12, 2006 7:58 am

Multiple form on one page

Post by creatco »

i have 3 form on one page. The first form have fields as name adress ...
The second form is only vibible by select a radio button on the first form.
The tird form only have one button. Can y now request in a php info from the first button by only clicking on the submit button/
Something like this.

$_REQUEST=[form1.name]

How can help me.

Thx
User avatar
jayshields
DevNet Resident
Posts: 1912
Joined: Mon Aug 22, 2005 12:11 pm
Location: Leeds/Manchester, England

Post by jayshields »

Your english is very bad, and your question is very hard to understand.

As far as I can understand, you've got 3 forms on one page, some of them have toggleable visibility.

If your form method is set to post, you can grab the values by using the $_POST superglobal, it's more secure than $_REQUEST.

You should name all your form elements differently, then you will be able to grab the value of the form element using $_POST['formelementname']. The example you've given is not correct in PHP, form1.name is something that would be used in JavaScript.
creatco
Forum Newbie
Posts: 2
Joined: Sun Mar 12, 2006 7:58 am

Post by creatco »

Sorry for my bad English. I will try to explain better wath I want to do.
I have indeed one page with 3 forms on. I want when I click on the submit button of form3 that I can read in a php file the info what is in form1 to send by mail.

This is the form action

<form action="sendmail.php" method="post" name="bevestig" onsubmit="return controle(document.f.info.valeu)">

and in the sendmail.php I have this :

$bedrijf = $_REQUEST['bedrijf']

bedrijf is a field on the form “f” on the same page as the form “bevestig”

when I do this I get this error.

Notice: Undefined index: bedrijf in C:\Creatcodataweb\TEXACO2005\sendmail.php on line 3

I hope this is better to understand
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Only one form is submitted at any given time. Combine them into a single form or put a submit button in each.
Post Reply