Myportal Posted May 18, 2021 Share Posted May 18, 2021 With the following code <?php extract($_POST); include("database.php"); $sql=mysqli_query($conn,"SELECT * FROM register where Email='$email'"); if(mysqli_num_rows($sql)>0) { echo "Email Id Already Exists"; exit; } else(isset($_POST['save'])) { $file = rand(1000,100000)."-".$_FILES['file']['name']; $file_loc = $_FILES['file']['tmp_name']; $folder="upload/"; $new_file_name = strtolower($file); $final_file=str_replace(' ','-',$new_file_name); if(move_uploaded_file($file_loc,$folder.$final_file)) { $query="INSERT INTO register(First_Name, Last_Name, Email, Password, File ) VALUES ('$first_name', '$last_name', '$email', 'md5($pass)', '$final_file')"; $sql=mysqli_query($conn,$query)or die("Could Not Perform the Query"); header ("Location: login.php?status=success"); } else { echo "Error.Please try again"; } } ?> There is still an error output of syntax error on line 11, please help, what's wrong with my code Quote Link to comment https://forums.phpfreaks.com/topic/312735-form-process-failure/ Share on other sites More sharing options...
gw1500se Posted May 18, 2021 Share Posted May 18, 2021 First please use the code icon (<>) in the menu and specific PHP for your code. Second, when you have an error, post it too so we know what the exact error is. Third, which is line 11 being referred to in the error? Finally what are you trying to accomplish with this line: $file = rand(1000,100000)."-".$_FILES['file']['name']; Quote Link to comment https://forums.phpfreaks.com/topic/312735-form-process-failure/#findComment-1586631 Share on other sites More sharing options...
Barand Posted May 18, 2021 Share Posted May 18, 2021 You appear to be missing an "if" elseif (isset($_POST['save'])) ^^ Quote Link to comment https://forums.phpfreaks.com/topic/312735-form-process-failure/#findComment-1586632 Share on other sites More sharing options...
gw1500se Posted May 18, 2021 Share Posted May 18, 2021 Damn! I missed the obvious. Quote Link to comment https://forums.phpfreaks.com/topic/312735-form-process-failure/#findComment-1586633 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.