I can get a single form to call itself again if there's nothing fancy going 
on. This code will prompt the user for their mail if it doesn't already 
exist, and if the email does exist, provides some data out of database.

<?php if ( !isset($_POST['email']) ): ?>
  <!-- No email, so prompt the user for one.-->

  <form action="<?=$_SERVER['PHP_SELF']?>" method="post">
  Login: <input type="text" name="email" />
  <input type="submit" value="GO" />
  </form>

<?php else: ?>

  <p>Data for email: <?=$_GET['email']?></p>
  // do some database stuff and display the results

<?php endif; ?>

I'd like to validate the email that was entered against a database - if the 
email address is found, continue on with the ELSE code. If not found, though, 
run the IF section again. 

Conceptually I'm missing how to do that. I've done it in two pages, where the 
form action calls a second PHP page, and the code in that second page looks 
for the address and displays one result or another depending on if it's 
found. 

How do I do this in one page, if it's appropriate and practical (i.e. good 
coding) to do so?

Thanks,

Whil

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to