0

hello friends This is my code.

$.post("submit_investorform.php",{'flage':'firstOverviewsubmit','comname':comaname,'amoutwisr':amoutwisr,'user_id':<?php echo $value = isset($_GET['user_id']) ?  $_GET['user_id'] : ""; ?>},function(result){
    if(result.trim() == 'Insert'){
        $(".noterror").html("Record Insert Successfully");
        $(".noterror").show();
        return false;
    }else if(result.trim() == 'error'){
        $(".errordisplay").html("Something was Wrong Please Try Again");
        $(".errordisplay").show();
        return false;
    }else if(result.trim() == "update"){
        $(".noterror").html("Record Updated Successfully");
        $(".noterror").show();
        return false;
    }

});

i want to do the user_id is set then is send into post request otherwise it send blank. but jQuery return syntax error.

please help.

1
  • what is the exact syntax error you are getting? Also is amoutwisr and comaname been defined somewhere? Commented Oct 30, 2013 at 4:55

1 Answer 1

3

try this

'user_id': '<?php echo $value = isset($_GET['user_id']) ?  $_GET['user_id'] : ""; ?>'

You need to wrap your PHP code within quotes to avoid syntax error, if the $_GET['user_id'] is not set.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.