Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <body>
- <?php
- if (isset($_POST['submit'])):
- $dbcnx = mysql_connect('localhost', 'root', '', 'programming');
- mysql_select_db('programming');
- //picks the fields from the form below
- $name = $_POST['name'];
- $email = $_POST['email'];
- //runs the query with the variable
- $sql = "INSERT INTO topics SET topictitle='$name', topicdescription='$email' ";
- if (@mysql_query($sql)) {
- echo('<p>New article added</p>');
- } else {
- echo('<p>Error adding new article: ' . mysql_error() . '</p>');
- }
- ?>
- <p><a href="<?=$_SERVER['PHP_SELF']?>">Add another FAQ</a></p>
- <?php
- else: // Allow the user to enter a new author
- ?>
- <form action="<?=$_SERVER['PHP_SELF']?>" method="post">
- <p>Enter the new FAQ:<br />
- Title: <input type="text" name="name" size="100" maxlength="255"
- /><br />
- Description: <br />
- <textarea name="email" maxlength="2000" cols="100" rows="12"></textarea>
- <br />
- <input type="submit" name="submit" value="SUBMIT" /></p>
- </form>
- <?php endif; ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment