Jump to content

Issue: Form Elements outside of form are not being recognised


simeonC

Recommended Posts

Issue I have a form which is submitted and entered to a database like all forms. The problem begins when I started using form elements outside of the form tags.

 

as such

<form action="shopfunction.php?repair_id=<?php echo urlencode($_SESSION['repair_id']) ?>" id="customer_info" method="post"  name="customer_info">
 <td align="center"><input type="text" name="tag" autocomplete="" value="<?php echo $customer_info['tag']?>"></td>
            <td align="center"><input type="text" name="vin" autocomplete="" value="<?php echo $customer_info['vin']?>"></td>
            <td align="center"><input type="text" name="miles_in" autocomplete="" value="<?php echo $customer_info['miles_in']?>"></td>
            <td align="center"><input type="text" name="miles_out" autocomplete="" value="<?php echo $customer_info['miles_out']?>"></td>
</form>
--------------------VVVVVVV-------------------These are outside the form tag----------However have the form id attribute to be recognised------------VVV
 <td align="left">Sublet/Others</td>
            <td align="left"><input type="text" name="others" size="10" form="customer_info" value="<?php echo $display_other;?>"></td>
          </tr>
          <tr>
            <td align="left">***Shop Supplies</td>
            <td align="left"><input type="text" name="supplies" size="10" form="customer_info" value="<?php echo $display_supply ?>"></td>
          </tr>
          <tr>
            <td align="left">***Fees</td>
            <td align="left"><input type="text" name="fees" size="10" form="customer_info" value="<?php echo $display_fees; ?>"></td>

I have no idea why may be you guys can help me. Have my php script recognise these elements as form elements

 

Probably because that was the whole point of having opening and closing form tags. The elements between those tags represent what is in the form. The form attribute is not supported in all browsers. So, if you want to be backward compatible you will need to put everything in the form tags

 

EDIT:

http://www.w3schools.com/tags/att_input_form.asp

 

 

The form attribute is supported in all major browsers, except Internet Explorer.

Im using safari and firefox. Should I still just wrap them in the form tag because it will break my code.

Depending on which version of those browsers you have, I suppose it should work. Maybe you have some other problem. But, you can put those other fields inside your form and have them displayed elsewhere on the page. Just use CSS to position them accordingly.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.