1

This is a html code for a simple contact form using bootstrap styling and the action linked in form tag to form_check.php I have been hitting my head hard as clicking the submit button doesnt perform any action and gives no output for even the simplest php script.

Heres the html part:

enter image description here

and heres the php script part in its simplest form still it is not working

enter image description here

Please help me out as even clicking the submit button performs no action at all.

3
  • can you use input type=submitintsead of button Commented Jun 21, 2016 at 3:28
  • @Aditya Sinha You can use <button></button> if you want. No need to replace with <input> just replace the type value from button to submit. You can have submit value for button's type attribute too. Commented Jun 21, 2016 at 5:07
  • Go through this basics: w3schools.com/tags/att_button_type.asp Commented Jun 21, 2016 at 5:13

4 Answers 4

2

Try this instead of using a button:

<input type="submit" name="submit" value="Submit" class="btn btn-primary">

The reason your form is not submitting is because <button type="button"> is clickable yes, but without an event handler, nothing will happen.

However, you can simply change <button type="button" to <button type="submit". Either one of these will work.

Sign up to request clarification or add additional context in comments.

Comments

1

use ,

<input type="submit" class="btn btn-primary" name="submit" value="Submit" />

instead of

<button type="button" class="btn btn-primary" name="submit" value="Submit" >submit</button>

Comments

0

You are going to have to change the button to an input and give it the attribute type="submit"

Buttons don't submit forms.

1 Comment

Button's can submit forms. You just need to have submit as value for type instead of button. Check basics: w3schools.com/tags/att_button_type.asp
0

If you want to use <button> instead of <input type="button"> just change this line:

<button type="button" class="btn btn-primary" name="submit" value="Submit" >submit</button>

to this:

<button type="submit" class="btn btn-primary" name="submit" value="Submit" >submit</button>

OR if you want js solution try this:

<button type="button" class="btn btn-primary" name="submit" value="Submit" onclick="$('#myForm').submit();" >submit</button>

Where myForm is id of your form

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.