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

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
manojsemwal1
Forum Contributor
Posts: 217
Joined: Mon Jun 29, 2009 4:13 am
Location: India

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

Post 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";
}
jamesm6162
Forum Newbie
Posts: 13
Joined: Sat Jun 28, 2008 10:31 am

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

Post by jamesm6162 »

Is the button wrapped in a form element?
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

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

Post by pickle »

Please take the time to post in the right forum. Moved.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
manojsemwal1
Forum Contributor
Posts: 217
Joined: Mon Jun 29, 2009 4:13 am
Location: India

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

Post 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.
jamesm6162
Forum Newbie
Posts: 13
Joined: Sat Jun 28, 2008 10:31 am

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

Post 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
Post Reply