Return True or False & how to get just on true in a loop
<p>I have this script that sends via $.post some information</p>

<pre><code>$("#clickme").click(function(e){  
var selected = $(".img input:checked").map(function(i,el){return el.name;}).get();
var prelucrare = selected.join(";")
$.post('test.php', {
    rezultat: prelucrare,    
},

function(data){
    $('#rez').html(data)
});  
});`
</code></pre>

<p>And the PHP file that handles the $.post</p>

<pre><code>&lt;?php
require_once '../config.php';
If(isSet($_POST['rezultat'])) {
$d = explode(';', $_POST['rezultat']);

foreach($d as $numar_inregistrare){
    $SQL = "DELETE FROM galerie_foto WHERE numar_inregistrare = '$numar_inregistrare'";
    $rezultat = mysql_query($SQL) or die(mysql_error());

    return true;          
}
} else {
exit;
}
?&gt;
</code></pre>

<p>I have two questions: 
1. How can I make the js script do a thing if the return value is true and an other thing if the return value is false ? Something like this ?</p>

<pre><code>  $.post('test.php', {
  rezultat: prelucrare,
       success: function(msg){
        valid = (msg == 1) ? true : false;
        if(!valid) {
            $("#valid_input").html("Please enter valid info");
        } else {
            $("#valid_input").html("");
        }
     }
   )};
</code></pre>

<ol>
<li>My other question is about the returning result, because I'm in a loop if there are 3 things in the array the result will be truetruetrue instead of just one true, what can I make to get just one true ?</li>
</ol>
