$target_user = null;
if (isset($_POST['friend_sel'])) {
    // If the friend_sel var is set in the POST vars, typecast it to an
    // integer and set the target_user
    $target_user = (int) $_POST['friend_sel'];
}
// By default we show the form, and the action_wave and wave_success are
// set to false.
$wave_success = false;
$action_wave = false;
$show_form = true;
if ($target_user) {
    $action_wave = true;
    $show_form = false;
    // The target_user is set, send them a greeting
    $wave_success = $app->wave_hello($user, $target_user);
}
?>

<fb:dashboard>
<fb:action href="/nghelloworld/">View My Greetings</fb:action>
<fb:action href="/nghelloworld/wave.php">Send a greeting</fb:action>
</fb:dashboard>

<div style="padding: 10px;">
  <h2>Hello <fb:name firstnameonly="true" uid="<?php 
echo $user;
?>
" useyou="false"/>!</h2><br/>
  <fb:if-is-app-user uid="<?php 
echo $user;