I am trying to get the app to automatically save searches for the user. Here is some of my code that is written up. What I am trying to achieve is the ability to enter random links from websites that I like and display the links within the app and automatically save the inputs. Is there a way to save links within a page in PHP? Here is a link of the code posted live - http://www.andulicsdesign.com/Blakes/Index.php Here is some of the javascript that I am trying to run. For some reason the code isn't working. How can I connect my application to a database so I can start displaying entries? - $(document).ready(function(){ $('#formid form').submit(function(e){ e.preventDefault(); $.get('result.php', $(this).serialize(),function(data){ $('#result').append(data);// If you're looking to save links and not write over previously searched results, then use append.});});}); Code (markup): <!doctype html> <html> <head> <meta charset="UTF-8"> <title>Indeed Link Search App</title> <script type="text/javascript"> $(document).ready(function() { $('#formid form').submit(function(){ $.get('result.php', $(this).serialize(), function(data){ $('#result').html(data); }); return false; }); }); </script> </head> <body> <div id="container> <div id="formid"> <form> Job Title<input type="text" name="message" value="" /> <input type="submit" value="Submit" /> </form> </div> <div id="result"> <?php echo '<div style="background-color:#fff; padding:20px">' . $_POST['message'] . '</div>'; ?> <?php $message=$_REQUEST['message']; echo $message; ?> </div> </div> </body> </html> Code (markup):
The first thing you are going to need is a database. In order to connect to the database you will need a database class to handle the connection and the reading/writing. You don't necessarily need a database class, you can use the built in PHP functions. But a class would work out of the box and there are thousands of them readily available on the internet. Once that is in place you just need to save the links in the database when the user hits submit and read them again when the page loads.