PHP Form submit Link doesn't work with validation.?

Miranda E

New member
I have a php form and when I try to send it with a link it doesn't validate the areas that need to be validated. It validates fine with a submit button but I don't want to use a submit button.

Here's my Submit link code:
<a class="button" href="javascript:document.contact_form.submit()"><span>Submit</span>

Here's the first bit of the form code:
<form id="contact_form" name="contact_form" method="post" action="to_contact_table.php">
my validation is php and my submit "button" / link is using javascript.
first answer didn't work
Is there a way to submit a form using a php link instead of a javascript one?
 
Hi, if you use javascript to validate and then submit you will not be able to use method="post" in:

<form id="contact_form" name="contact_form" method="post" action="to_contact_table.php">

change it to method="get"

You will also have to change your javascript submit link:
href="javascript:document.contact_form.s...

to send your form fields to your php file.

Like this:
formname.location="to_contact_table.php?firstname=John&lastname=smith
 
Hi, if you use javascript to validate and then submit you will not be able to use method="post" in:

<form id="contact_form" name="contact_form" method="post" action="to_contact_table.php">

change it to method="get"

You will also have to change your javascript submit link:
href="javascript:document.contact_form.s...

to send your form fields to your php file.

Like this:
formname.location="to_contact_table.php?firstname=John&lastname=smith
 
Back
Top