Page 1 of 1

isset($_POST['submit']) not working

Posted: Fri Dec 11, 2009 5:08 am
by manojsemwal1
Hai Iam using below code in my script.

Code: Select all

if($semid<$b['DId'])
         {
                        echo"<tr><td colspan='6'><div align='center'><input type='submit'  name ='process' value='Process to Next Semester >>' class='inputsubmit'></div></td></tr>";
                        }
                         else
                         {
                          echo "<tr><td colspan='6'><div align='center'><input type='submit'  name ='complete'  value='Processed To Complete Course' class='inputsubmit'></div></td></tr>";
                          }
when the $semid value below Did then if Condition button will display else another button will display.
in the submitting form when i press the button no action occured. iam using below code to access the get value on the press any button.

Code: Select all

if(isset($_POST['process']))
{
  echo "hai";
}
 
 
if(isset($_POST['complete']))
{
echo "hhai";
}

Re: isset($_POST['submit']) not working

Posted: Fri Dec 11, 2009 11:01 am
by jamesm6162
Is the button wrapped in a form element?

Re: isset($_POST['submit']) not working

Posted: Fri Dec 11, 2009 11:47 am
by pickle
Please take the time to post in the right forum. Moved.

Re: isset($_POST['submit']) not working

Posted: Fri Dec 11, 2009 11:52 pm
by manojsemwal1
yes button is wrapped in form
<script type="text/javascript">
window.addEvent('domready', function(){
$('registerForm').addEvent('submit', function(e) {
new Event(e).stop();
var log = $('log_res').empty().addClass('ajax-loading');
this.send({
update: log,
onComplete: function() {
log.removeClass('ajax-loading');
}
});
});
});
</script>
hai iam using mootools inside <head>
and my body function like ...
<form method="post" name='frm' id="registerForm" action="procenextsem.php">
when i remove id="registerForm" then its working fine.
when i used from id its not working why...any solutions.

Re: isset($_POST['submit']) not working

Posted: Sat Dec 12, 2009 3:52 am
by jamesm6162
I am not familiar with MooTools, but I would guess that means there is an error in your javascript code.
This results in the fact that you are overriding the default onsubmit event with one that doesn't work and effectively does nothing.
Remember that your code is in effect trying to cancel the normal form submit and instead use ajax to submit the form. So the page isn't supposed to reload, just display the ajax-loading and then fill the desired "log" with the result returned from the page.

I think (as I said I don't really know MooTools) the send() function you are trying to use on the form itself via
this.send({...})
is supposed to be used on a new Request object such as

Code: Select all

new Request("http://someurl").send({options...})
By the way, this is in fact entirely a Javascript problem, not php