Advertisement
Guest User

Untitled

a guest
Oct 24th, 2014
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.41 KB | None | 0 0
  1. // Page object
  2.  
  3. $homepage = new Page('Questions and Answers', 'QA', '', 'You ask, we answer');
  4.  
  5. // Author object
  6.  
  7. $author = new Author($fname, $lname);
  8.  
  9. // Question object
  10.  
  11. $question = new Question($your_question, $author);
  12.  
  13. // Database object
  14.  
  15. $pdo = new DbConnect($host, $dbname, $username, $password);
  16.  
  17. // Connect to the database
  18.  
  19. $pdo->open_connection();
  20.  
  21. $pdo->execute_query('INSERT INTO author (first_name, last_name) VALUES (?, ?)', array($author->getFirstName(), $author->GetLastName()));
  22. $pdo->close_connection();
  23. $homepage->content = '<h3>Your question</h3><br><p>Hello ' . $author->getFirstName() . ' ' . $author->getLastName() . '!' . '</p><br>';
  24. $homepage->content .= '<p>You ask: ' . $question->getQuestion() . '</p><br>';
  25. $homepage->content .= 'Do you want to ';
  26. $homepage->content .= '<a href="index.php">Ask another question?</a>' . ' ' . '<br>';
  27.  
  28. $homepage->content = <<<_END
  29.  
  30. <h3>Your question here</h3><br>
  31. <form action="{$_SERVER['PHP_SELF']}" method="post" role="form">
  32. <label for="fname">Enter your first name</label><br>
  33. <input type="text" id="fname" name="fname" size="30"><br>
  34. <label for="lname">Enter your last name</label><br>
  35. <input type="text" id="lname" name="lname" size="30"><br>
  36. <label for="question">What is your question?</label><br>
  37. <textarea id="question" name="question" rows="10" cols="70"></textarea><br>
  38. <input type="submit" name="submit" value="Submit">
  39. </form>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement