Created
October 13, 2014 19:24
-
-
Save tlovett1/ada6798879280ab99c92 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// START INDEX.PHP | |
$mantras = mysql_fetch_assoc( mysql_query( 'SELECT COUNT(*) as count FROM mantras' ) ); | |
?> | |
Total mantras: <?php echo $mantras['count']; ?> | |
<form method="post" action="process.php"> | |
<input type="text" name="mantra"> | |
<input type="submit" value="Submit"> | |
</form> | |
<?php | |
// END INDEX.PHP | |
// START PROCESS.PHP | |
if ( ! empty($_POST['mantra']) ) { | |
mysql_query( 'INSERT .... INTO mantras' ); | |
// redirect back to old file | |
header( 'Location: index.php' ); | |
} | |
?> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment