I need some help with setting up a session.....
The image is what i am trying to design.

<?php
session_start();
// store session data
$_SESSION['views']=1;
?>

<html>
<body>

<?php
//retrieve session data
echo "Pageviews=". $_SESSION['views'];
?>

</body>
</html>

Recommended Answers

All 13 Replies

Hi there, not really sure what you are trying to do, your diagram isn't very informative. Please post some more specific info, thanks

Say you bring up a web page and it is called Page A. Page A is a web page that has a Text field with a submit button. When you type in some text into the text field and hit submit, you post the content in the text field to PAGE B and you (the user) goes to a PAGE C. Page A will then be included into Page D. When you visit Page A a second time the TextArea is populated with the content you submitted the last time. When the text field is changed again it removes the old content and saves the new content.

My question is how do i make the Text box on Page A be populated with the content on PAGE B.

Why does it have to be setup that way? Usually there is a much simpler solution.

Im willing to hear your idea

You haven't explained the overall goal of the project, therefore I cannot come up with a better idea yet. So far, you have provided us with your setup, not what you are trying to accomplish.

CMS is what im trying to design, i want somone to be able to goto an edit page and edit text content in a simple text box...... and send/save button..... when they go back to the edit page the contect that they posted the time before is in the text box, if they wish they can change it and send/save.

When you are saving the new content posted via the web form what exactly is it doing.

I know you are editing a page but how. Are you adding the POSTed data to a document or a MySql database?

Either way you would just pull the document they editied last and echo it out between the <textarea> tags of your form.

If this is indeed what you meant?

If so then I will be able to explain a little more and give the others a heads up on exactly what you mean. Else theres not much use me posting code for something not relative to your issue.

Hello Steven,

you should first send the thread ID to the edit page using Session variable. Then in the edit page, using MySQL and the thread ID, retrieve the data about that particular content and put it as the value of the text area.
Now if Send/Save button is pressed, save the data in database using thread ID and value as the new value of the text area, else don't save the data in the database.

I hope i have understand your question in this manner, hope this will help you.... If it helped you add it to my reputation. Thanks

CMS is what im trying to design, i want somone to be able to goto an edit page and edit text content in a simple text box...... and send/save button..... when they go back to the edit page the contect that they posted the time before is in the text box, if they wish they can change it and send/save.

Your on the ball Josh Connerty. I would like to stay away from the data base do to maintenance. I will make it in a database if i have to.
thanks

Your on the ball Josh Connerty. I would like to stay away from the data base do to maintenance. I will make it in a database if i have to.
thanks

So you wish to edit the file that contains the content for the specific page?

In this case you may want to take a look at w3schools file tutorials so we are on the same level (will provide a link).

In a sense what you will need to do is have a page with a drop down list with all of the different pages they can edit then have it post an ID to the next document. From there you will need to use the ID to open the file consistant with the ID and echo out the contents of the file to the textarea.

Then when you submit this it should take you to the preview page where it will also save the new contents to the document so you may need to post the ID of the page once more in a hidden field so as this document knows the file to reference also.

So from then on whoever goes to the page they have just edited it will be as they eddited it. And when they return they will have what they last changed in the textarea as you are reading the file before they edit it again.

The link for the w3schools tutorial is below:
http://w3schools.com/php/php_file.asp

Oh yes and it is deffinetly more efficient to have a table with the page id's and the file source so as it's more effeciently referenced via the documents.

Maintainence should be painless with one table with two fields.

This is a display interface i would like to use

Thats fine but I am not doing it for you. Try doing it like I said and if you come accross any problems then I can help. ;-)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.