Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Page object
- $homepage = new Page('Questions and Answers', 'QA', '', 'You ask, we answer');
- // Author object
- $author = new Author($fname, $lname);
- // Question object
- $question = new Question($your_question, $author);
- // Database object
- $pdo = new DbConnect($host, $dbname, $username, $password);
- // Connect to the database
- $pdo->open_connection();
- $pdo->execute_query('INSERT INTO author (first_name, last_name) VALUES (?, ?)', array($author->getFirstName(), $author->GetLastName()));
- $pdo->close_connection();
- $homepage->content = '<h3>Your question</h3><br><p>Hello ' . $author->getFirstName() . ' ' . $author->getLastName() . '!' . '</p><br>';
- $homepage->content .= '<p>You ask: ' . $question->getQuestion() . '</p><br>';
- $homepage->content .= 'Do you want to ';
- $homepage->content .= '<a href="index.php">Ask another question?</a>' . ' ' . '<br>';
- $homepage->content = <<<_END
- <h3>Your question here</h3><br>
- <form action="{$_SERVER['PHP_SELF']}" method="post" role="form">
- <label for="fname">Enter your first name</label><br>
- <input type="text" id="fname" name="fname" size="30"><br>
- <label for="lname">Enter your last name</label><br>
- <input type="text" id="lname" name="lname" size="30"><br>
- <label for="question">What is your question?</label><br>
- <textarea id="question" name="question" rows="10" cols="70"></textarea><br>
- <input type="submit" name="submit" value="Submit">
- </form>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement