roldahayes Posted June 20, 2008 Share Posted June 20, 2008 Hi There, heres what I'm trying to achieve... I'm building a site listing different quotes and sayings. What I want to be able to do is from a page, have the client be able to type the quote into a text field, select from a dropdown which page the quote to appear on and then press a button and the quote uploads to the relivant page... I am familier with the creating a login page so thats all fine, but am stuck on the next step! Quote Link to comment Share on other sites More sharing options...
abdfahim Posted June 20, 2008 Share Posted June 20, 2008 Dont you want to have a database? Because it'll be much easier if you use database. When ever client click on submit button, you save the quote,page_belongs_to in your database. Then in that relevant page, read only the those quotes from database which belongs to that page. Quote Link to comment Share on other sites More sharing options...
waynew Posted June 20, 2008 Share Posted June 20, 2008 You'll need to first create a table that will hold these quotes. On the page where they get to upload these quotes, you'll need a select form that has every one of your pages in it. <select> <option value="1">Love</option> <option value="2" selected>Life</option> <option value="3">Religion</option> </select> Notice that each page has its own number. Now, when placing these quotes into your quote table, you should also have a column that has the corresponding number with it. Then, say on the Love page, you could have a script like this: $result = mysql_query("SELECT * FROM quotes WHERE page_number = 1"); That way, it will only take out all of the quotes associated with love. $result = mysql_query("SELECT * FROM quotes WHERE page_number = 3"); The above code would select all quotes on religion. Hope that helps. Quote Link to comment Share on other sites More sharing options...
roldahayes Posted June 20, 2008 Author Share Posted June 20, 2008 WOW! Thanks for the quik replies! I'll start to work through your suggestions and If I need more help (which I probably will...!) I'll post back! Cheers. Quote Link to comment Share on other sites More sharing options...
waynew Posted June 20, 2008 Share Posted June 20, 2008 You'll have to make it a little more secure than what I just posted however. Quote Link to comment Share on other sites More sharing options...
waynew Posted June 20, 2008 Share Posted June 20, 2008 Because if I were to save that webpage to my desktop, change the HTML of the select (change Love to 3 etc) and then post the form, you could end up having all sorts of quotes on each page, effectively ruining your website..... You'll probably want to set up a system where you can confirm each post before it's allowed on the page. That'll also stop crappy quotes with bad spelling being posted. Quote Link to comment Share on other sites More sharing options...
roldahayes Posted June 20, 2008 Author Share Posted June 20, 2008 Thanks for that, Its actually only going to be the person running the site who will be doing the uploading. I'm trying to make their life easier by not having to edit HTML and then FTP - but I'll take the security side of things into account. Quote Link to comment Share on other sites More sharing options...
waynew Posted June 20, 2008 Share Posted June 20, 2008 Either way, just make sure the clients login is secured. Password. Sessions etc. Quote Link to comment Share on other sites More sharing options...
roldahayes Posted June 20, 2008 Author Share Posted June 20, 2008 Ok, stumbling at the first hurdle...! Can anyone help with creating the database. I'm using PHPamyadmin... ??? Quote Link to comment Share on other sites More sharing options...
roldahayes Posted June 20, 2008 Author Share Posted June 20, 2008 Ok, I think this is right. - I've created a database. - Created a table called "quotes" with a column of "sport" - On my page I have <?php $result = mysql_query("SELECT * FROM quotes WHERE page_number = sport");?> - Created a page with a form for the select boxes and text box to input in but how do I get them to upload?? Quote Link to comment Share on other sites More sharing options...
roldahayes Posted June 20, 2008 Author Share Posted June 20, 2008 guess that should have been <?php $result = mysql_query("SELECT * FROM quotes WHERE page_number = 1");?> Just found out that using numerical will speed thing up a bit... Still not sure how to code the upload form though...? Quote Link to comment Share on other sites More sharing options...
roldahayes Posted June 21, 2008 Author Share Posted June 21, 2008 ok, ive created my table like this CREATE TABLE `quotes` ( `1` VARCHAR( 200 ) NOT NULL , `2` VARCHAR( 200 ) NOT NULL , `3` VARCHAR( 200 ) NOT NULL ); my form is <form method="post" action=""> Name:<br> <input name="quotes" type="text" id="quotes"> <br> Email: <br> <select> <option value="1">Sport</option> <option value="2" selected>Movies</option> <option value="3">General</option> </select><br> <br> <input type="submit" name="Submit" value="Submit"> </form> What code do I need to make the form actually work?? Quote Link to comment Share on other sites More sharing options...
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.