Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => General

Php isset POST issue

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

Php isset POST issue

Postby wapachii » Mon Aug 04, 2014 12:04 pm

Hi, first off here is the code:

Code: Select all
<?php
require 'core.inc.php';

if(!loggedIn()){
   if(isset($_POST['LicenseIDRegister'])&&isset($_POST['firstnameRegister'])&&isset($_POST['lastnameRegister'])&&isset($_POST['emailRegister'])&&isset($_POST['passwordRegister'])&&isset($_POST['confirmpasswordRegister'])&&isset($_POST['securityqRegister'])&&isset($_POST['securityaRegister'])&&isset($_POST['tandc'])&&isset($_POST['RegisterButton'])){
      $license=$_POST['LicenseIDRegister'];
      $firstname=$_POST['firstnameRegister'];
      $lastname=$_POST['lastnameRegister'];
      $email=$_POST['emailRegister'];
      $password=$_POST['passwordRegister'];
      $confirm_password=$_POST['confrimpasswordRegister'];
      $secuityq=$_POST['securityqRegister'];
      $securitya=$_POST['securityaRegister'];
      $tandc=$_POST['tandc'];
      if(!empty($license)&&!empty($firstname)&&!empty($lastname)&&!empty($email)&&!empty($password)&&!empty($confirm_password)&&!empty($securityq)&&!empty($securitya)&&!empty($tandc)){
         echo "Okay";
      }else{
         echo "All fields are required";
   }
}else{
      echo "error in isset somehwere";
   }

?>   
   
   <form name="register" method="POST" action="Register.php">
<div id="licenseID">License code: <br><input type="text" name="licenseIDRegister"></div>
<div id="forgottenLicense">Forgotten your license code? click <a href="recoverLicense.php">here</a></div>
<div id="firstname">Firstname: <br><input type="text" name="firstnameRegister"></div>
<div id="lastname">Lastname: <br><input type="text" name="lastnameRegister"></div>
<div id="email">Email: <br><input type ="text" name="emailRegister"></div>
<div id="password"> Password: <br><input type="password" name="passwordRegister"></div>
<div id="confirmPassword">Confirm Password: <br><input type="password" name="confirmpasswordRegister"></div>
<div id="securityq">Security Question: <br><input type="text" name="securityqRegister"></div>
<div id="securitya">Secuirty Answer: <br><input type="text" name="securityaRegister"></div>
<div id="captcha">Captcha will be done shortly</div>
<div id="tandc"><input type="checkbox" name="tandc"> I have read and
accept the <a href="tandc.php">terms and conditions</a></div>
<input id="submitRegistration" type="submit" value="Submit" name="RegisterButton">
</form>
   
<?php
}else if(loggedIn()){
   echo "you are already logged in";
}
?>


So what i'm trying to make is a registration page however for there is a problem with the line 5. I've looked over the code several times and it looks perfectly fine however always returns the result "error in isset somewhere" (refer to line 21) when I try to run it. i am completely stumped with this one, I hope someone can help :)
wapachii
New php-forum User
New php-forum User
 
Posts: 1
Joined: Mon Aug 04, 2014 11:55 am

Re: Php isset POST issue

Postby Strider64 » Tue Aug 05, 2014 5:59 am

Why don't you just do this on top:

Code: Select all
if ( isset($_POST['RegisterButton']) && $_POST['RegisterButton'] == 'Submit' ) {
   // Your processing registration script goes here....
}


and I don't know why you are checking to see if a user's is login in or not on a registration page, for it seems like a waste of time? I mean that is why they are registering in the first place? Unless I'm missing something? :oops:

You can always validate the user's input inside the registration script, if that was what you were trying to do? Though I would do that in JavaScript as the main way of validating and also have it done in PHP if you want graceful degradation (for those people who disable JavaScript).
User avatar
Strider64
New php-forum User
New php-forum User
 
Posts: 68
Joined: Sat Mar 23, 2013 8:24 am


Return to PHP coding => General

Who is online

Users browsing this forum: Google [Bot] and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.