473,480 Members | 1,585 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

php form issue ..

4 New Member
hi ... im looking for an example to make a form where the user input data, and then the user click on a buttom that after that "click" the user is taken to an other form to continue filling data that later is sent to an email address ...

if there is no example, would you please tellme how to do this process ?..
thanks in advance ...
greetings .. emmanuel
Jul 28 '06 #1
7 2309
ronverdonk
4,258 Recognized Expert Specialist
Gotta give some more info, such as:
  • do you want validation for the first form to be performed within the first form?
  • is the name of the second form dependent on input of the first form?
  • do you want to pass information from the first to the second form using GET or via SESSION variables?

Ronald :cool:
Jul 28 '06 #2
eeau1973
4 New Member
Hi ... thanks for the reply ..

Gotta give some more info, such as:
  • do you want validation for the first form to be performed within the first form?

No, i donīt need validation data for the first form ...maybe for the second form in some fields
  • is the name of the second form dependent on input of the first form?
No, i just need to continue filling fields
  • do you want to pass information from the first to the second form using GET or via SESSION variables?
i use post in my forms, but if you think using get is ok thanks a lot ...

Thanks a lot again !
:D



Ronald :cool:
Jul 28 '06 #3
ronverdonk
4,258 Recognized Expert Specialist
I really don't understand why you would want to have a 2-part form, but the following shows how you could do this. I used a HTML file for the first one, since there is no PHP involved.

[PHP]
FORM1.HTML code:
<html>
<head>
<title>Testit</title>
</head>
<body>
<form name="myform1" action="form2.php" method="POST">
Enter value for form 1 <input type="text" name="field1" />
<input type="submit" name="submit" value="Submit form1" />
<input type="hidden" name="_submit1" value="1" />
</form>
</body>
</html>

FORM2.PHP code:
<?php
if (isset($_POST['_submit2'])) { // called from this script
// validate $_POST['field2'] etc.
// do whatever you want to with that data
echo 'submit=2' . $_POST['field2']; // just for your test
}
elseif (isset($_POST['_submit1'] )) { // called from form1
// validate $_POST['field1'] etc.
echo 'submit=1' . $_POST['field1']; // just for your test
// display form2
?>
<form name="myform2" action="form2.php" method="POST">
Enter value for form 2 <input type="text" name="field2" />
<input type="submit" name="submit" value="Submit form2" />
<input type="hidden" name="_submit2" value="1" />
</form>
<?php
}
?>[/PHP]

The echo's are there just for the test.
Hope this is what you meant, though I can't think why.

Ronald :cool:
Jul 28 '06 #4
eeau1973
4 New Member
Exactly .. that`s the html code that i need ... now the thing is how can i send an email that contains both data fields forms ... i mean the data that the user input in form1 and in the form 2 ...

thanks in advance ... :D
Jul 28 '06 #5
iam_clint
1,208 Recognized Expert Top Contributor
you will do something like this eeau

Expand|Select|Wrap|Line Numbers
  1.  FORM1.HTML code:
  2. <html>
  3. <head>
  4. <title>Testit</title>
  5. </head>
  6. <body>
  7. <form name="myform1" action="form2.php" method="POST">
  8.     Enter value for form 1 <input type="text" name="field1" />
  9.   <input type="submit" name="submit" value="Submit form1" />
  10. </form>
  11. </body>
  12. </html>
  13.  
  14. FORM2.PHP code:
  15. <?php
  16. $field1 = $_POST['field1'];
  17. if (isset($_POST['submit'])) {
  18. //display form 2
  19. ?>
  20. <form name="myform2" action="form3.php" method="POST">
  21.   Enter value for form 2 <input type="text" name="field2" />
  22.   <input type="hidden" name="field1" value="<?=$field1?>">
  23.   <input type="submit" name="submit" value="Submit form2" />
  24. </form>
  25. <?php
  26. }
  27. ?> 
  28.  
  29.  
  30. FORM3.PHP code:
  31. <?php
  32. $field1 = $_POST['field1'];
  33. $field2 = $_POST['field2'];
  34. if (isset($field1) and isset($field2)) {
  35. ?>
  36. Thanks for filling out this form!
  37. <?
  38. } else {
  39. ?>
  40. All Fields Not Filled Out!
  41. <?
  42. }
  43. ?>
  44.  
Jul 28 '06 #6
ronverdonk
4,258 Recognized Expert Specialist
form2: start a session.
in '_submit1' processing:
save the field1 variable in the session
display form2

in '_submit2' processing:
build your email message with field1 and field2
send the email

That's it.

Ronald :cool:
Jul 28 '06 #7
iam_clint
1,208 Recognized Expert Top Contributor
You could do it that way but transferring hidden fields works also choose your way and good luck.
Jul 28 '06 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

5
4581
by: Tyler Style | last post by:
Hullo - looking for a little advice here. I have a form on a page in one domain submitting to a cgi in another domain. Weirdly, on some Windows XP systems, a form on the page fails to submit/post...
2
3023
by: google | last post by:
Hello everyone, I am having an issue using the "Multi Select" option in a list box in MS Access 2003. I am making a form that users can fill out to add an issue to the database. Each issue can...
22
4988
by: Br | last post by:
First issue: When using ADPs you no longer have the ability to issue a me.refresh to save the current record on a form (the me.refresh does a requery in an ADP). We usually do this before...
5
3917
by: ortaias | last post by:
I have a form which calls up a second form for purposes of data entry. When closing the data entry form and returning to the main form, things don't work as expected. When I return to the main...
4
8486
by: crystal | last post by:
I've checked the threads but haven't been able to come up with a solution to my issue. Help...... I have a simple form based on a table. Within the form is a subform that is also, through a Q,...
11
5256
by: Zytan | last post by:
I have created a new form from the main form. When I close the main form with the 'x' close button, its Form.FormClosed event is run, but not the dialog's. Is this normal? It is ok /...
26
2780
by: Jerim79 | last post by:
I need to create a form that takes a number that the user enters, and duplicates a question the number of times the user entered. For instance, if the customer enters 5 on the first page, when...
22
3028
by: Zytan | last post by:
I have public methods in a form. The main form calls them, to update that form's display. This form is like a real-time view of data that is changing. But, the form may not exist (it is...
1
2607
by: peck2000 | last post by:
Related to my earleir post ... this is the same project to re-purpose the Classifieds application in BEGINNING ASP 3.0 (Wrox) to a comicbook database ... This is a brainteaser that should have...
5
2977
by: programmerboy | last post by:
I never had this kind of issue before and it is completely surprising. I have a usercontrol where I need 2 forms to make 1 form. When I have only 1 form it submits the page to itself. I have spent...
0
7044
marktang
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,...
0
6908
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7045
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7087
jinu1996
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...
1
6741
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
6944
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
4782
isladogs
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...
0
2995
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...
0
2985
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.