chris2 Posted May 31, 2012 Report Posted May 31, 2012 Hi Can anyone please show me how i can make a page in dreamwever, where a user can enter information, store it on the SQL database and then another page which shows the information? Many Thanks chris Quote
Tom Posted May 31, 2012 Report Posted May 31, 2012 https://www.google.co.uk/search?&ie=UTF-8&q=php+mysql+tutorial Quote
Sava Posted June 1, 2012 Report Posted June 1, 2012 The basic idea is to create a form <form method="post" action="yourfile.php"> <input type="text" name="ur_name"/> <!-- some more input fields here --> <input type="submit" name="submit" value="Submit Form!"/> </form> and then inside yourfile.php do something like <?php $name=mysql_escape_string($_POST['ur_name']; //and same goes for other fields if( some verification you want here) { mysql_query("INSERT INTO TABLE_NAME (name, and other values separated by , ) values ('$name')"); }else{ //do something else } ?> To display the info: <?php $query = mysql_query("SELECT * FROM users"); $count = mysql_num_rows($query); $smth=mysql_fetch_array($query); if ( $count > 0 ) { echo $smth['name'] //and other from array } else { echo "no data can be retrieved for specifed conditions or smth like that"; } ?> Bare in mind that I wrote this in 3mins and that this is not completely correct way of doing things and it can be prone to a lot of hacks. This is just to give you a basic idea on how to do things. Check W3 schools to see how to INSERT, GET, DELETE, CHANGE etc. stuff from a MySQL database using PHP. Hope this helps you out a bit. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.