1

I have a really long form, which is basically a sign up for a college. And it's been working fine, although for some reason now I am not able to receive the POST data for the form anymore. I seem to receive all the variables, expect for the 'SUBMIT' button, which is what I look for to find out that it's posted.

It's a sliding form, meaning that it's about 450px high and it is split up into different 'pages', and at the bottom of each page there is previous, save for later, and next buttons. The previous and next activate jQuery functionality which slides the form left or right. The save for later button is a submit button which puts any received data into the database for retrieval later. The HTML for these buttons is:

<input type='button' class='previous' value='Previous'>
<input type='submit' class='saveforlater' name='saveforlater' value='Save For Later'>
<input type='button' class='next' value='Next'>

All three of these buttons work fine, if I test the receiving of saveforlater in PHP like so:

if(isset($_POST['saveforlater'])) {
    // Do Stuff
}

It works every time.

However, right at the end of the form I have this:

<input type='button' class='previous' value='Previous'>
<input type='submit' class='next send' name='sendapplication' value='Send Application'>

And It used to work, but I cannot figure out what I've changed in order to stop it working. If I var_dump($_POST), I get all the other variables, except for this button.

So if I try to:

if(isset($_POST['sendapplication'])) {

I get nothing. NOTHING! I don't know why :(. It's such a simple thing and it's frustrating me.

halfer
  • 19,824
  • 17
  • 99
  • 186
Chud37
  • 4,907
  • 13
  • 64
  • 116

4 Answers4

2

If you click this button, you will see with var_dump or debug() returns this variable.

For submit buttons inside <form>, only buttons clicked will be setted as $_POST variable with its value.

bcesars
  • 1,016
  • 1
  • 17
  • 36
1

Your input should have the attribute name. Your html should look like

<input type='button' class='previous' name='previous' value='Previous'> 
<input type='submit' class='saveforlater' name='saveforlater' value='Save For Later'>
<input name='saveforlater' type='button' class='next' value='Next'>

Your php should look like in /enrol

<?php
var_dump($_POST);

Hope this helps you

Balázs Édes
  • 13,452
  • 6
  • 54
  • 89
Utkarsh Dixit
  • 4,267
  • 3
  • 15
  • 38
1

How many fields are there in your form?? I think it is the problem due to size of limited post request. It is the problem of server configuration. If you want to control it refer following link

What is the size limit of a post request?

Community
  • 1
  • 1
Kavita
  • 77
  • 7
1

If you're using a HTML form to send the data and a localhost server, your attribute action needs to have the PHP file directory on the server.

Dave Schweisguth
  • 36,475
  • 10
  • 98
  • 121
chris
  • 11
  • 1