Check if all the field are filled, if yes then login via Google and save records of the fields PHP


Check if all the field are filled, if yes then login via Google and save records of the fields PHP



I have a form in PHP HTML in which the user fills some fields on button press I want to check if all the fields are filled, if yes then check if the user is logged in, if yes then save records if no then proceed to google login procedure save user credentials and save the input filed records



input page as evaluate.php





function SaveReview(){
//alert("I am here");
var UserId = document.getElementById('UserId').value;
var company = document.getElementById('company').value;
var Id = document.getElementById('Id').value;
var star = document.getElementById('star').value;
var review = document.getElementById('review').value;
var reviewtitle = document.getElementById('reviewtitle').value;
var infoemail = document.getElementById('infoemail').checked;
var email = document.getElementById('email').value;
var domain = document.getElementById('domain').value;
// alert(infoemail);
if(UserId == 0){

alert("Please Login First and then try again");
return false;
}
else if(star == "-- Please Select --"){
alert("Please select Star rating");
return false;
}
else if(review == 0){
alert("Please Enter Review");
return false;
}
else if(reviewtitle == 0){
alert("Please Enter Title for Review");
return false;
}
else{
//alert("Sb sahi hai");
document.getElementById('savereview').submit();
}
//alert(domain);
}


<style>
.btn-facebook{
background-color:#5c76a9}
.btn-google{
background-color:#DC4437}
</style>


<?php
include("dblocal.php");
$UserId = $_SESSION["usersessionid"];
if(isset($_REQUEST["CompanyId"])){
$CompanyId = $_REQUEST["CompanyId"];
}
if(isset($_REQUEST["website"])){
$website = $_REQUEST["website"];
}
$sql = "SELECT Id, CompanyName, EmailId FROM company WHERE Id = $CompanyId";
$result = $conn->query($sql);
//echo $sql;
$row = $result->fetch_assoc();
$Id = $row["Id"];
$CompanyName = $row["CompanyName"];
$EmailId = $row["EmailId"];

$EPos = strpos($EmailId,"@");
$Int = substr($EmailId,0,$EPos);
$Domain = substr($EmailId,$EPos);
//echo $EmailId;
$EmailValue = $Int."".$Domain;
?>









Voice your opinion! Review /company?CompanyId="> now.



savereview">



" />
" />

" placeholder="Enter Company Name" />


" placeholder="Enter website Url" readonly="readonly" />



 
Website


" placeholder="Enter Company Name" />-->


Your Review



-- Please Select --
1
2
3
4
5



Rating











 


Roll over stars, then click to rate.



</div>


Your Review





Review Title





Edit

</div>
</div>

Let know about your review. Just check the box and we'll notify them.

The review will be sent to:



"/>
" />

</div>
<?php
if(isset($UserId)){
?>



<?php
}else{
?>


Post and Verify Yourself with



 Log in with Facebook



 Log in with Google


 Email

</div>
<?php
} ?>
</div>
</div>
</form>
</div>



What is Trustpilot?


Trustpilot is a review community. We help consumers everywhere find companies they can trust.



Share your experiences


and be a part of our community. It couldn't be easier - with your Trustpilot account you can write, edit and share your reviews from one convenient location.




</div>

</div>
</div>
</div>
</div>

</div>





please if any one can help how can i do it because on checking google login method it redirects to other page
– Hassan Masood
Jun 29 at 8:23





Welcome to SO! Your question is a bit too broad and not that easy to read. If you update your formatting and be more specific about where you're stuck in the process, your chances of getting an answer will be much higher. Good luck!
– Bert H
Jun 29 at 8:27





@BertH i just want to check the data if fields are filled if yes then login via Google and save all data just
– Hassan Masood
Jun 29 at 8:49









By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Comments

Popular posts from this blog

paramiko-expect timeout is happening after executing the command

Export result set on Dbeaver to CSV

Opening a url is failing in Swift