Quantcast
Channel: Topic Tag: MySQL | WordPress.org
Viewing all articles
Browse latest Browse all 5527

medardo on "Create a PHP form in a page and populate it from a MySQL table"

$
0
0

Thanks Radices, I'll check Formidable Pro Forms, but I would like to build my own stuff if possible.

Thanks hearvox, answering your question: the echo I use after executing the query and before closing the big (6 lines) php block shows the desired data, however the echo inside the form block doesn't. Maybe the value of $result is lost when the php block is closed? Here is the entire code I wrote in the WP post (page):

<?php
global $wpdb;
$id = 2;
$result = $wpdb->get_results( "SELECT * FROM 4ps_people WHERE id=" . $id);
echo $result[0]->name;
?>
<form>
  Name: <input type="text" value="<?php echo $result[0]->name; ?>"/> </br>
</form>

Viewing all articles
Browse latest Browse all 5527

Trending Articles