Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 06-09-2012, 01:12 AM   PM User | #16
Kyle$calise
New Coder

 
Join Date: May 2012
Location: Warminster, PA, USA
Posts: 39
Thanks: 8
Thanked 0 Times in 0 Posts
Kyle$calise is an unknown quantity at this point
Quote:
Originally Posted by dan-dan View Post
After you've done that try again and let me know whwat happens.
Now, when I go to the edit page, select "Home" and click "Edit", it takes me to the index page with nothing where the text should go.

(At least we got rid of the error message. )
__________________
Kyle$calise
Kyle$calise is offline   Reply With Quote
Old 06-09-2012, 01:17 AM   PM User | #17
dan-dan
Regular Coder

 
dan-dan's Avatar
 
Join Date: Aug 2009
Location: England
Posts: 483
Thanks: 22
Thanked 79 Times in 78 Posts
dan-dan is on a distinguished road
See my last post, I just updated it! Don't forget you need something in the database too before it appears. I hope you didn't delete your content.
dan-dan is offline   Reply With Quote
Old 06-09-2012, 01:21 AM   PM User | #18
Kyle$calise
New Coder

 
Join Date: May 2012
Location: Warminster, PA, USA
Posts: 39
Thanks: 8
Thanked 0 Times in 0 Posts
Kyle$calise is an unknown quantity at this point
Quote:
Originally Posted by dan-dan View Post
See my last post, I just updated it! Don't forget you need something in the database too before it appears. I hope you didn't delete your content.
You've got me totally confused now.

I had already ran the previous query you posted.

(I didn't even know I had a table named pages.)
__________________
Kyle$calise
Kyle$calise is offline   Reply With Quote
Old 06-09-2012, 01:30 AM   PM User | #19
dan-dan
Regular Coder

 
dan-dan's Avatar
 
Join Date: Aug 2009
Location: England
Posts: 483
Thanks: 22
Thanked 79 Times in 78 Posts
dan-dan is on a distinguished road
You didn't have a table until you ran that query which created it! However, I updated the query to add the 'home' and 'books' values to make your life a little easier.

Just find that table named 'pages' and delete it. Then follow the steps again to recreate it with the new values.

After that's done, if all goes right you should just be able to copy your HTML into the textarea and it should be saved into the database, thus displaying on your webpage

Again, this is the code you need to use once it's deleted. I've highlighted in red the difference from the last table.:
Code:
-- phpMyAdmin SQL Dump
-- version 3.4.5
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Generation Time: Jun 09, 2012 at 02:12 AM
-- Server version: 5.5.16
-- PHP Version: 5.3.8

SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;

--
-- Database: `pages`
--

-- --------------------------------------------------------

--
-- Table structure for table `pages`
--

CREATE TABLE IF NOT EXISTS `pages` (
  `page` varchar(20) NOT NULL,
  `content` varchar(10000) NOT NULL,
  PRIMARY KEY (`page`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--
-- Dumping data for table `pages`
--

INSERT INTO `pages` (`page`, `content`) VALUES
('books', ''),
('home', '');

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;

Last edited by dan-dan; 06-09-2012 at 01:34 AM..
dan-dan is offline   Reply With Quote
Old 06-09-2012, 01:40 AM   PM User | #20
Kyle$calise
New Coder

 
Join Date: May 2012
Location: Warminster, PA, USA
Posts: 39
Thanks: 8
Thanked 0 Times in 0 Posts
Kyle$calise is an unknown quantity at this point
Quote:
Originally Posted by dan-dan View Post
You didn't have a table until you ran that query which created it! However, I updated the query to add the 'home' and 'books' values to make your life a little easier.

Just find that table named 'pages' and delete it. Then follow the steps again to recreate it with the new values.

After that's done, if all goes right you should just be able to copy your HTML into the textarea and it should be saved into the database, thus displaying on your webpage
Okay... that's done. But it still doesn't show anything in the area.

What's the difference between the "Edit" and "Submit" buttons? Here's what I've tried so far:

*Select page (Home) in dropdown menu, and click "Edit". Takes me to the index page, with no text in the area.
*Select page (Home) in dropdown menu, type in textarea, and click "Edit". Takes me to the index page, with no text in the area.
*Select page (Home) in dropdown menu, type in textarea, and click "Submit". Takes me to the index page, with no text in the area.

(Thanks so much for putting up with me. xD )
__________________
Kyle$calise
Kyle$calise is offline   Reply With Quote
Old 06-09-2012, 01:46 AM   PM User | #21
dan-dan
Regular Coder

 
dan-dan's Avatar
 
Join Date: Aug 2009
Location: England
Posts: 483
Thanks: 22
Thanked 79 Times in 78 Posts
dan-dan is on a distinguished road
Click on home in the dropdown then click edit, meaning to edit the home page (it won't show anything at this point as you don't have anything saved in the database).

Now type something into the textarea (which would normally contain the page content).

Click submit to update the content.

Maybe change the 'submit' value to 'save changes' to make it a bit clearer.
dan-dan is offline   Reply With Quote
Old 06-09-2012, 01:49 AM   PM User | #22
Kyle$calise
New Coder

 
Join Date: May 2012
Location: Warminster, PA, USA
Posts: 39
Thanks: 8
Thanked 0 Times in 0 Posts
Kyle$calise is an unknown quantity at this point
Quote:
Originally Posted by dan-dan View Post
Click on home in the dropdown then click edit, meaning to edit the home page (it won't show anything at this point as you don't have anything saved in the database).
I've tried that, and it just takes me to the index page with nothing in the editable area.
__________________
Kyle$calise
Kyle$calise is offline   Reply With Quote
Old 06-09-2012, 01:54 AM   PM User | #23
dan-dan
Regular Coder

 
dan-dan's Avatar
 
Join Date: Aug 2009
Location: England
Posts: 483
Thanks: 22
Thanked 79 Times in 78 Posts
dan-dan is on a distinguished road
Lol. Just looked at the code you posted again and it's because you've got <form action="index.php" method="post"> on your edit page, meaning the index page will process the form.

Change it to <form action="" method="post">
dan-dan is offline   Reply With Quote
Users who have thanked dan-dan for this post:
Kyle$calise (06-09-2012)
Old 06-09-2012, 02:02 AM   PM User | #24
Kyle$calise
New Coder

 
Join Date: May 2012
Location: Warminster, PA, USA
Posts: 39
Thanks: 8
Thanked 0 Times in 0 Posts
Kyle$calise is an unknown quantity at this point
Quote:
Originally Posted by dan-dan View Post
Lol. Just looked at the code you posted again and it's because you've got <form action="index.php" method="post"> on your edit page, meaning the index page will process the form.

Change it to <form action="" method="post">
Yaaaay!!! Thank you, thank you, thank you!

+1 Rep.

I can't believe it! You're awesome!
__________________
Kyle$calise
Kyle$calise is offline   Reply With Quote
Old 06-09-2012, 02:08 AM   PM User | #25
dan-dan
Regular Coder

 
dan-dan's Avatar
 
Join Date: Aug 2009
Location: England
Posts: 483
Thanks: 22
Thanked 79 Times in 78 Posts
dan-dan is on a distinguished road
No worries, glad we got there

I'm not sure if you've done it already, but remember that on your books page you need to edit the query to:
PHP Code:
$result mysql_query('SELECT content FROM pages WHERE page ="books"'); 
If you have any other problems with it just ask.
dan-dan is offline   Reply With Quote
Old 06-09-2012, 01:35 PM   PM User | #26
Kyle$calise
New Coder

 
Join Date: May 2012
Location: Warminster, PA, USA
Posts: 39
Thanks: 8
Thanked 0 Times in 0 Posts
Kyle$calise is an unknown quantity at this point
Hey,

Everything's working great.

Just out of curiosity, would you have any idea how we might have the editor pick up on the current data?

Example, select the page you want to edit, click "Edit", previous table entry appears in editor.

That way, if someone makes a spelling error or something, they can just keep the same text, but change only a small bit of it.

Any ideas?

Thanks again!
__________________
Kyle$calise
Kyle$calise is offline   Reply With Quote
Old 06-09-2012, 08:02 PM   PM User | #27
dan-dan
Regular Coder

 
dan-dan's Avatar
 
Join Date: Aug 2009
Location: England
Posts: 483
Thanks: 22
Thanked 79 Times in 78 Posts
dan-dan is on a distinguished road
Sorry, I'm confused! When you click edit after selecting a page, doesn't the current page already show in the textarea for edit? Does it just appear blank?
dan-dan is offline   Reply With Quote
Old 06-09-2012, 10:08 PM   PM User | #28
Kyle$calise
New Coder

 
Join Date: May 2012
Location: Warminster, PA, USA
Posts: 39
Thanks: 8
Thanked 0 Times in 0 Posts
Kyle$calise is an unknown quantity at this point
Quote:
Originally Posted by dan-dan View Post
Sorry, I'm confused! When you click edit after selecting a page, doesn't the current page already show in the textarea for edit? Does it just appear blank?
OMG, it does show it correctly!

You're one step ahead of the game!

Thanks!
__________________
Kyle$calise
Kyle$calise is offline   Reply With Quote
Old 06-09-2012, 10:36 PM   PM User | #29
dan-dan
Regular Coder

 
dan-dan's Avatar
 
Join Date: Aug 2009
Location: England
Posts: 483
Thanks: 22
Thanked 79 Times in 78 Posts
dan-dan is on a distinguished road
Me one step ahead, or you one step behind haha
dan-dan is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 11:06 PM.


Advertisement
Log in to turn off these ads.