Beginner with form questions

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
jswalt
Forum Newbie
Posts: 6
Joined: Mon Jul 06, 2009 9:27 am

Beginner with form questions

Post by jswalt »

Is it possible to have a form inside another form and have them both use the same submit button? I have a "Contact Us" form that I have been trying to implement a file upload feature into. The "Contact Us" form is just a drag and drop form using Yahoo Sitebuilder. The file upload feature I managed to get working after trying some PHP code I have come across and making some minor modifications to it. The both work fine on their own, but when I try to drop the file upload html code into the Yahoo Sitebuilder form, it doesn't work properly...even with two submit buttons. Am I trying to do something that shouldn't be done...it seems like I am wanting one form that does two different actions at the same time? I can put a link in to go to the file upload feature and just keep it separate from the "Contact Us" form, but prefer to have it all integrated into one. I would appreciate any help in this matter. I can also provide the html code and php file if need be. Thanks.
User avatar
jackpf
DevNet Resident
Posts: 2119
Joined: Sun Feb 15, 2009 7:22 pm
Location: Ipswich, UK

Re: Beginner with form questions

Post by jackpf »

You can only submit one form at a time.

And you can't have a form within a form.

I don't understand..what's not working?
jswalt
Forum Newbie
Posts: 6
Joined: Mon Jul 06, 2009 9:27 am

Re: Beginner with form questions

Post by jswalt »

Thanks for the quick responses. To answer the first question of what's not working, I want to get contact information sent to my email address at the same time any files that are present get uploaded to the Yahoo server. I want this to be transparent to the user so they don't have to go through two steps. Right now, I can only get the contact form to email me the contact information or I can get the files to upload to the Yahoo server...but I can't get both to happen at the same time. If you look at the jpg image that I attached, you will see what I am talking about regarding a "form within a form".

Regarding the second user response, it is both a visual placement issue and user simplicity that is the reason I am trying to integrate the file upload feature into the "contact us" form. I have attached a jpg image of the "look" that I am trying to achieve.

I appreciate the comments and suggestions. I understand how frustrating it can be working with a beginner like myself. Please forgive any "stupid" questions or comments that I might make due to my ignorance with this type of programming. Thanks.
Attachments
form issue.jpg
form issue.jpg (123.5 KiB) Viewed 127 times
preferred form.jpg
preferred form.jpg (66.55 KiB) Viewed 131 times
User avatar
jackpf
DevNet Resident
Posts: 2119
Joined: Sun Feb 15, 2009 7:22 pm
Location: Ipswich, UK

Re: Beginner with form questions

Post by jackpf »

If you want to send data to two seperate servers, you'll have to either have two pages, or submit the data with cURL or sockets or something.
Jamesiv2
Forum Newbie
Posts: 1
Joined: Sun Oct 24, 2010 6:01 am

Re: Beginner with form questions

Post by Jamesiv2 »

Have your form post to a 3rd script which includes one and two:

<?php
include ('script_01.php');
include (script_02.php');
?>
Post Reply