Jump to content

Upload a quote to certain pages:


roldahayes

Recommended Posts

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!

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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??

Link to comment
Share on other sites

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??

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.