My experience is that real data makes it less complicated.
It sounds a lot like you should be doing a query to check, and if the check passes, then do the insert statement. Think about it this way: if it's not valid, won't you want to display an error to the user? Your above idea would not work. Alternatively, you might be able to use a foreign key constraint so you'd have a basic insert statement, and rely on the FK to throw an error.
The only way I can think of where you
might be able to pull this off would be the following:
INSERT INTO user (f1, f2, f3) SELECT DISTINCT '$val1', '$val2', '$val3' from state where idState='$idState' and idCountry=3;
The idea here is to hardcode the values you want to insert using an insert-select statement, but limit the rows based on the other conditions. Not sure if that would work or not. I tossed in a DISTINCT in case there's more than one match in table state.