# Dreamweaver cs5 - Forms



## robfet (Feb 6, 2012)

Hello,

I'm new on this forum and almost on Dreamweaver CS5. I almost have my webpage but I need to make a page to "apply". Is a paper form (4 sheets) and we want to put it on the webpage and when the user fills all the form, just press "submit" and send it to an email, all the information. I was searching on the web how to do it, and I found that with a form, but since are 4 sheets I should do it in parts, I mean, first sheet then next sheet and all the information will be stored or saved until the user finish the form and click "Submit". Another doubt was when I finished the form, whats the next step? PHP? this is where you guys could help me how to figure out.


I'm very lost and I wish like to find the better way to do the form.

I'm using Dreamweaver CS5.


----------



## Silverj2k7 (Aug 31, 2008)

Hi there,

Here is an example of how to do the PHP submit button to get you started.
HTML - PHP Form Example

Secondly 4 sheets of forms? It might be an idea to try and eliminate any irrelevant data however, what types of data are you handling? By having to store information, your best bet is to store the variables in PHP however, I am pretty noobie PHP-wise so I bet laxer or someone else with more experience will be able to help you out more. 

This will also be useful 
PHP Variables


----------



## robfet (Feb 6, 2012)

Correct, the form at least the form has 3 sheets, its a loan application so the all the information is required.

Let me review the link you put.

Thanks...


----------



## Laxer (Dec 28, 2010)

If you need any additional help feel free to post.

I am familiar with PHP and should be able to help you reach your desired goal.


----------



## robfet (Feb 6, 2012)

One friend of mine told me that I can do kind of trick on the form application. In the same webpage I can put two div's (in one div I have half of form) and hide one first, when they fill out the last field press next and hide that one and unhide the other, after that the submit button and all div's data can be send.

Can this be possible?


----------



## Laxer (Dec 28, 2010)

Yes but it will require some scripting that is not html...

You could use javascript to display:none/block easily.

or you could use something like php to check if the first form is submitted then hide it and display the second...

Both are pretty simple to do.

Create the two forms then I can show you what to do next :grin:


----------



## robfet (Feb 6, 2012)

*Doesnt work!!!*

Hello,

I'm facing problems with some javascript code, I use the code for hide and unhide div's. A div "form1" is always displayed, when someone finishes filling out the form, it will press "Next" to access the other part, div "form2". If I try looking the results from dreamweaver CS5 at "Live View" it works!!!
but when I try to open it with IE or Firefox nothing happens when pressing "Next".


```
<script type="text/javascript">
function toogle_view()
{
    var div = document.getElementById();
          document.getElementById("form1").style.display = "none";
          document.getElementById("form2").style.display = "block";
}

</script>
```
Next code:

```
<td colspan="2" rowspan="2"><a href="javascript:toogle_view();">NEXT</a></td>
```
Can someone help me please?


----------



## liamm (Jan 6, 2012)

*Re: Doesnt work!!!*

try something like:

```
<td colspan="2" rowspan="2"><a href="#" onClick="toogle_view()">NEXT</a></td>
```
or you can load jQuery:

```
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {

$('#my_id').click(function(){
$('#form1').hide();
$('#form2').show();
});

//OR something like this
$('#my_id').click(function(){
$('#form1').css('display','none');
$('#form2').css('display','block');
});
});

</script>

//and your link should have the id #my_id
<a href="#" id="my_id">NEXT</a>
```


----------



## Laxer (Dec 28, 2010)

*Re: Doesnt work!!!*

Here is another similar solution to try:
Replace your javascript with this:

```
<script type="text/javascript">
<!--
    function toogle_view(id,id2) {
       var e = document.getElementById(id);
       var f = document.getElementById(id2);
       if(e.style.display == 'block')
          e.style.display = 'none';
          f.style.display = 'block';
       else
          f.style.display = 'none';
          e.style.display = 'block';
    }
//-->
</script>
```
Then just change your link to this:


```
<td colspan="2" rowspan="2"><a href="#" onClick:"toogle_view('form1','form2');">NEXT</a></td>
```
Nice thing about this is you can adjust it to keep changing forms...

Example... form 2 -> form 3


```
<td colspan="2" rowspan="2"><a href="#" onClick:"toogle_view('form2','form3');">NEXT</a></td>
```


----------



## robfet (Feb 6, 2012)

Actually I did it that way. First I show form1 then a next button to hide and unhide form2. Now the final step, send the form by email. I know that with PHP I can do it.

Any ideas?


----------



## robfet (Feb 6, 2012)

*Re: Doesnt work!!!*

thank you for your help.

Now I need to send the information to an email, I know that using PHP this is possible. 

Any ideas?


----------



## Laxer (Dec 28, 2010)

If you can provide me a link to the form or the source of it I can walk through setting up the PHP with you.

I would use php...

First thing snag all the variables from the form:

PHP POST: PHP $_POST Variable

Next email: PHP: mail - Manual

I can help you set it up if you provide us with a link

Also, I merged your threads :grin:


----------



## robfet (Feb 6, 2012)

Thanks Laxer for your time.

I don't have the page up yet, I'm doing it on a local site with dreamweaver, so I guess can't give you a link???? I really don't know so tell me what can I do,you're the expert..

thanks


----------



## Laxer (Dec 28, 2010)

Just zip the site folder and upload it here...

This will give me all the code you are using so that I can see things as you do :grin:


----------



## robfet (Feb 6, 2012)

Was a long weekend!! :smile:


Let me zip the file and upload it.

thanks


----------



## robfet (Feb 6, 2012)

Laxer attached is the folder.

The page is not ready yet, but the apply section is the one I need your help.

Let me know if you need something else.

Thanks again!


----------



## Laxer (Dec 28, 2010)

Let's get started shall we?

Here is the form:

```
<form id="form3" name="form2" method="post" action="">
        <table width="800" border="0" align="center">
          <tr>
            <td colspan="4" align="center"><strong>FINANCING INFORMATION</strong></td>
          </tr>
          <tr>
            <td width="130">Purpose of Financing</td>
            <td colspan="3"><p>
              <label>
                <input type="radio" name="RGpurposeFinan" value="radio" id="RGpurposeFinan_0" tabindex="1" />
                Materials</label>
              <label>
                <input type="radio" name="RGpurposeFinan" value="radio" id="RGpurposeFinan_1" tabindex="2" />
                Equipment</label>
              <label>
                <input type="radio" name="RGpurposeFinan" value="radio" id="RGpurposeFinan_2" tabindex="3" />
                Inventory</label>
              <label>
                <input type="radio" name="RGpurposeFinan" value="radio" id="RGpurposeFinan_3" tabindex="4" />
                Supplies</label>
              <label>
                <input type="radio" name="RGpurposeFinan" value="radio" id="RGpurposeFinan_4" tabindex="5" />
                Working Capital</label>
              <br />
            </p></td>
          </tr>
          <tr>
            <td>Collateral</td>
            <td width="244"><input type="text" name="collateral" id="collateral" tabindex="6" /></td>
            <td width="150">Guarantor(s)' Name(s)</td>
            <td width="258"><input type="text" name="guarantorsName" id="guarantorsName" tabindex="8" /></td>
          </tr>
          <tr>
            <td>Guarantors</td>
            <td><input type="text" name="guarantors" id="guarantors" tabindex="7" /></td>
            <td>Guarantor(s)' Address(es)</td>
            <td><input type="text" name="guarantorAddress" id="guarantorAddress" tabindex="9" /></td>
          </tr>
          <tr>
            <td colspan="4"> </td>
          </tr>
          <tr>
            <td colspan="4"><em>This is to certify that I/We have provided accurate information in good faith with the intent of obtaining a loan for the purposes expressed in this application. Further, I/We have fully disclosed all information as requested on this application and all other supporting documents submitted with the intent of obtaining financing. I/We fully under stand that delivery of fraudulent information with the intent to defraud <strong>National Express Credit, LLC</strong> its funding sources, or agents may result criminal prosecution.</em></td>
          </tr>
          <tr>
            <td>Applicant</td>
            <td><input type="text" name="applicant" id="applicant" tabindex="10" /></td>
            <td>Company Name</td>
            <td><input type="text" name="companyName" id="companyName" tabindex="11" /></td>
          </tr>
        </table>
        <p> -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------</p>
        <table width="800" align="center">
          <tr>
            <td width="131"><label for="principalsName">Principal(s) Name</label></td>
            <td width="241"><input type="text" name="principalsName" id="principalsName" tabindex="12" /></td>
            <td width="155">Percent Ownership</td>
            <td width="253"><input type="text" name="percentOwner" id="percentOwner" tabindex="14" /></td>
          </tr>
          <tr>
            <td><label for="principalSignature">Principal(s) Signature</label></td>
            <td><input type="text" name="principalSignature" id="principalSignature" tabindex="13" /></td>
            <td><label for="date">Date</label></td>
            <td><input type="text" name="date" id="date" tabindex="15" /></td>
          </tr>
          <tr>
            <td><label for="principalName2">Principal(s) Name</label></td>
            <td><input type="text" name="principalName2" id="principalName2" tabindex="16" /></td>
            <td><label for="percentOwner2">Percent Ownership</label></td>
            <td><input type="text" name="percentOwner2" id="percentOwner2" tabindex="18" /></td>
          </tr>
          <tr>
            <td><label for="principalSignature2">Principal(s) Signature</label></td>
            <td><input type="text" name="principalSignature2" id="principalSignature2" tabindex="17" /></td>
            <td><label for="date2">Date</label></td>
            <td><input type="text" name="date2" id="date2" tabindex="19" /></td>
          </tr>
          <tr>
            <td><label for="principalName3">Principal(s) Name</label></td>
            <td><input type="text" name="principalName3" id="principalName3" tabindex="18" /></td>
            <td><label for="percentOwner3">Percent Ownership</label></td>
            <td><input type="text" name="percentOwner3" id="percentOwner3" tabindex="20" /></td>
          </tr>
          <tr>
            <td><label for="principalSignature4">Principal(s) Signature</label></td>
            <td><input type="text" name="principalSignature3" id="principalSignature4" tabindex="19" /></td>
            <td><label for="date3">Date</label></td>
            <td><input type="text" name="date3" id="date3" tabindex="21" /></td>
          </tr>
          <tr>
            <td><label for="principalName4">Principal Name</label></td>
            <td><input type="text" name="principalName4" id="principalName4" tabindex="22" /></td>
            <td><label for="percentOwner4">Percent Owner</label></td>
            <td><input type="text" name="percentOwner4" id="percentOwner4" tabindex="24" /></td>
          </tr>
          <tr>
            <td><label for="principalSignature5">Principal Signature</label></td>
            <td><input type="text" name="principalSignature4" id="principalSignature5" tabindex="23" /></td>
            <td><label for="date4">Date</label></td>
            <td><input type="text" name="date4" id="date4" tabindex="25" /></td>
          </tr>
        </table>
        <p align="right"><a href="javascript:previousForm();"> <strong> <font size="4">Previous</font> </strong> </a></p>
        <p align="right"><strong> <font size="4">Finish</font> </strong> </a></p>
      </form>
    </div>
    <div id="main_text">
      <form id="form1" name="form1" method="post" action="">
        <table width="818" id="table2">
          <tr>
            <td height="29" colspan="2"><strong>PRINCIPAL OWNER INFORMATION</strong></td>
            <td>Employer Tax ID Number </td>
            <td><input type="text" name="employerTaxID" id="employerTaxID" tabindex="21" /></td>
          </tr>
          <tr>
            <td width="122">Social Security #</td>
            <td width="265"><input name="socialSec" type="text" id="socialSec2" size="10" maxlength="10" tabindex="1" /></td>
            <td width="169">Business Status</td>
            <td width="242"><label>
              <input type="radio" name="RGbusinessStat" value="radio" id="RGbusinessStat_0" tabindex="22" />
              Start Up</label>
              <label>
                <input type="radio" name="RGbusinessStat" value="radio" id="RGbusinessStat_1" tabindex="23" />
                Existing</label></td>
          </tr>
          <tr>
            <td>Principal Owner's Name</td>
            <td><input name="ownersName" type="text" id="ownersName" size="30" tabindex="2" /></td>
            <td>Year Established (MM/DD/YYYY)</td>
            <td><input name="yearEstablishedB" type="text" id="yearEstablishedB" tabindex="24" size="10" /></td>
          </tr>
          <tr>
            <td>Address</td>
            <td><input name="address" type="text" id="address" size="40" tabindex="3" /></td>
            <td>Legal Structure (Choose One)</td>
            <td><label>
              <input type="radio" name="RGlegalStruc" value="radio" id="RGlegalStruc_0" tabindex="25" />
              Sole Propietor</label>
              <label>
                <input type="radio" name="RGlegalStruc" value="radio" id="RGlegalStruc_1" tabindex="26" />
                Partnership</label>
              <br />
              <label>
                <input type="radio" name="RGlegalStruc" value="radio" id="RGlegalStruc_2" tabindex="27" />
                Corporation</label>
              <label>
                <input type="radio" name="RGlegalStruc" value="radio" id="RGlegalStruc_3" tabindex="28" />
                Other</label></td>
          </tr>
          <tr>
            <td>City</td>
            <td><input name="city" type="text" id="city" size="20" tabindex="4" /></td>
            <td colspan="2"><strong>BUSINESS DEMOGRAPHICS</strong></td>
          </tr>
          <tr>
            <td>State</td>
            <td><input name="state" type="text" id="state" size="5" tabindex="5" /></td>
            <td><label for="businessRev">Business Revenue<br />
            </label></td>
            <td><p>
              <label>
                <input type="radio" name="RGbusinessRev" value="radio" id="RGbusinessRev_0" tabindex="29" />
                Actual</label>
              <label>
                <input type="radio" name="RGbusinessRev" value="radio" id="RGbusinessRev_1" tabindex="30" />
                Proposed 12 Mos</label>
              <br />
              <input name="businessRev" type="text" id="businessRev" size="30" tabindex="31" />
              <br />
            </p></td>
          </tr>
          <tr>
            <td>Zip</td>
            <td><input name="zip" type="text" id="zip" size="10" tabindex="6" /></td>
            <td><label for="noEmployees">Number of Employees</label></td>
            <td><input type="text" name="noEmployees" id="noEmployees" tabindex="32" /></td>
          </tr>
          <tr>
            <td>Country</td>
            <td><input name="country" type="text" id="country" size="15" tabindex="7" /></td>
            <td><p>Number of Jobs<br />
            </p></td>
            <td><label>
              <input type="radio" name="RGnoJobs" value="radio" id="RGnoJobs_0" tabindex="33" />
              Created</label>
              <input type="radio" name="RGnoJobs" value="radio" id="RGnoJobs_1" tabindex="34" />
              Retained<br /></td>
          </tr>
          <tr>
            <td>Phone Number</td>
            <td><input name="phoneNumber" type="text" id="phoneNumber" size="12" tabindex="8" /></td>
            <td colspan="2"><strong>OTHER COMPLIANCE INFORMATION</strong></td>
          </tr>
          <tr>
            <td>Fax</td>
            <td><input name="fax" type="text" id="fax" size="12" tabindex="9" /></td>
            <td>Business In Emp Zone</td>
            <td><p>
              <label>
                <input type="radio" name="RGempZone" value="radio" id="RGempZone_0" tabindex="35" />
                Yes</label>
              <label>
                <input type="radio" name="RGempZone" value="radio" id="RGempZone_1" tabindex="36" />
                No</label>
              <br />
            </p></td>
          </tr>
          <tr>
            <td>Two References<br />
              (name and telephone)</td>
            <td><input name="references" type="text" id="references" size="30" tabindex="10" /></td>
            <td>Business In Ent Zone</td>
            <td><p>
              <label>
                <input type="radio" name="RGentZone" value="radio" id="RGentZone_0" tabindex="37" />
                Yes</label>
              <label>
                <input type="radio" name="RGentZone" value="radio" id="RGentZone_1" tabindex="38" />
                No</label>
              <br />
              <br />
            </p></td>
          </tr>
          <tr>
            <td height="23" colspan="2"><strong>BUSINESS INFORMATION</strong></td>
            <td>Principal Is Low Income</td>
            <td><p>
              <label>
                <input type="radio" name="RGlowIncome" value="radio" id="RGlowIncome_0" tabindex="39" />
                Yes</label>
              <label>
                <input type="radio" name="RGlowIncome" value="radio" id="RGlowIncome_1" tabindex="40" />
                No</label>
              <br />
            </p></td>
          </tr>
          <tr>
            <td>Business Name </td>
            <td><input name="businessName" type="text" id="businessName" tabindex="11" size="30" /></td>
            <td colspan="2"><strong>LOAN INFORMATION (PROPOSED BY PRINCIPAL)</strong></td>
          </tr>
          <tr>
            <td>Business Type</td>
            <td><input type="text" name="businessType" id="businessType" tabindex="12" /></td>
            <td><label for="amountLoanReq">Amount of Loan Request</label></td>
            <td><p>
              <input name="amountLoanReq" type="text" id="amountLoanReq" tabindex="41
            " size="15" />
              <br />
            </p></td>
          </tr>
          <tr>
            <td>Product or Service </td>
            <td><input type="text" name="productService" id="productService" tabindex="13" /></td>
            <td><label for="interestRate">Interest Rate</label></td>
            <td><input name="interestRate" type="text" id="interestRate" tabindex="42" size="8" /></td>
          </tr>
          <tr>
            <td>Address</td>
            <td><input name="businessAddress" type="text" id="businessAddress" tabindex="14" size="40" /></td>
            <td><label for="requestLoanTerm">Request Loan Term</label></td>
            <td><input name="requestLoanTerm" type="text" id="requestLoanTerm" tabindex="43" size="10" /></td>
          </tr>
          <tr>
            <td>City</td>
            <td><input name="businessCity" type="text" id="businessCity" tabindex="15" size="20" /></td>
            <td><label for="RecommLoanTerm">Recommended Loan Term</label></td>
            <td><input name="RecommLoanTerm" type="text" id="RecommLoanTerm" tabindex="44" size="10" /></td>
          </tr>
          <tr>
            <td>State</td>
            <td><input name="businessState" type="text" id="businessState" tabindex="16" size="5" /></td>
            <td><label for="monthLOanPay">Monthly Loan Payment</label></td>
            <td><input name="monthLOanPay" type="text" id="monthLOanPay" tabindex="45" size="10" /></td>
          </tr>
          <tr>
            <td>Zip</td>
            <td><input name="businessZip" type="text" id="businessZip" tabindex="17" size="10" /></td>
            <td><label for="annualDebtS">Annual Debt Service</label></td>
            <td><input name="annualDebtS" type="text" id="annualDebtS" tabindex="46" size="10" /></td>
          </tr>
          <tr>
            <td>Country</td>
            <td><input name="businessCountry" type="text" id="businessCountry" tabindex="18" size="15" /></td>
            <td><label for="maturityDate">Maturity Date</label></td>
            <td><input name="maturityDate" type="text" id="maturityDate" tabindex="47" size="10" /></td>
          </tr>
          <tr>
            <td>Phone Number </td>
            <td><input name="businessPhone" type="text" id="businessPhone" tabindex="19" size="12" /></td>
            <td colspan="2" rowspan="2" align="right"><a href="javascript:nextForm();" onclick="scroll(0,0)"> <strong> <font size="4">Next </font> </strong> </a></td>
          </tr>
          <tr>
            <td>Fax</td>
            <td><input name="businessFax" type="text" id="businessFax" tabindex="20" size="12" /></td>
          </tr>
        </table>
      </form>
```
First things I noticed:
You don't have an action for the form... (this needs to be the php page)
You don't have a submit button for the form...Ignoring those lets get onto the PHP...

First thing to do is get all the information from the form...
Here is how I would do it:

```
$RGpurposeFinan = $_POST['RGpurposeFinan'];
```
Where $RGpurposeFinan is the variable name.
$_POST reads the form for the input with the name: RGpurposeFinan

The same should be done with all inputs:

```
$collateral = $_POST['collateral'];
$guarantorsName = $_POST['guarantorsName'];
$guarantors = $_POST['guarantors'];
...
...
$businessFax = $_POST['businessFax'];
```
Once you have that done test to make sure you got the variables correctly by echoing them...


```
echo $RGpurposeFinan
```
Once you are done let me know and we can get onto some basic error trapping before sending the email.


----------



## robfet (Feb 6, 2012)

Laxer thank you and sorry for my mistakes.

Well, I done with what you told me.

I could sent the first form information, I received correctly to the email, but the problem now, since are two forms, the last one when the submit button is, is the only one that sends the data. 

I guess because form1 was hidden???

How can I send both, form1 and form1 no matter if form1 is hidden.


----------



## Laxer (Dec 28, 2010)

You only need one form for this...

You can hide half of the form at a time by putting it inside a div.

Does that make sense?

I can explain more if needed.


----------



## robfet (Feb 6, 2012)

ok thanks.

As you can see at the code, form1 is displayed first. At the bottom is a Next text that hides that form and shows the form2. In the form2 is the submit button. So only the form2 values are emailed.


----------



## robfet (Feb 6, 2012)

Well I decided to just create one form, so I could a avoid showing and hiding forms.

So now mi form runs successfully.

Thanks for your help.


----------



## Zildjyn (Oct 8, 2010)

I need help with image swaps in Dreamweaver CS5. I'm able to do it but I have an image that is a landscape and when I roll over the thumbnail it still put in into a spot that is set up for portraits. How can I tell it to adjust the size of the image? Does it have anything to do with place holders?


----------

