session_start(); if ($_SERVER['REQUEST_METHOD'] == 'POST') { $_SESSION['said'] = $_POST['said']; echo '<a href="">click here</a>'; } else { if (isset($_SESSION['said'])) { echo 'You said: ' . $_SESSION['said']; unset($_SESSION['said']); } else { echo '<form method="post">'; echo '<input type="text" name="said">'; echo '<input type="submit">'; echo '</form>'; } }
<?rb
if @w.req.post? @w.session['said'] = @w.f('said') @w << '<a href="">click here</a>' else if @w.session['said'] @w << "You said: #{@w.session['said']}" @w.session.unset 'said' else @w << '<form method="post">' @w << '<input type="text" name="said">' @w << '<input type="submit">' @w << '</form>' end end
BTW, your example made me spot a bug and fix it and also add the "unset" method to the Session class. Cool enough. Thanks! :-)
-----