Jump to content

Recommended Posts

Okay so it has been about 6+ months since i've even looked at a piece of PHP code.  I am again working on my site for helping people in graphics and programming alike. However I need some help myself...

 

Let me see if I can try and explain what I want as much as I can.

 

I am working on my Administration Panel right now, and within my administration panel I have a few pages that I will want to do this on...  Lets start with the first one, and lets make the first page be the About Us page...

 

So, About Us is just that, about the site and how it came to be, just a 1 cell table in the database....

 

When you click on the link in the navigation the text that actually displays in the database shows up as it displays on the actual website...  Now that is easy, but here is the tricky part that I can't figure out, though im sure it has something to do with JavaScript and DIV tags (i just dont know how to write it)...

 

At the bottom of the "About Us" text there will be a button that if clicked -- the sample text will be hidden, and the full form to edit the text will be revealed...

 

Then when you hit the Save button in the bottom of that, it will save the information to the database, hide the form and reveal the sample text once again...

 

Any clue how to do this? because I have no clue what so ever...

Link to comment
https://forums.phpfreaks.com/topic/51431-solved-some-help-needed/
Share on other sites

<tr id="texttr">

.........

........

Displayed Text

.........

........

 

</tr>

<tr id="formtr" style="display:none">

............

...........

Form to Edit

........

.........

</tr>

<tr>

<a href="#" onclick="javascript:hideshow('form')">Show form</a>

</tr>

<tr>

<a href="#" onclick="javascript:hideshow('text')">Show Text</a>

</tr>

<script language="javascript">

function hideshow(fel){

if(fel == 'form'){

document.getElementById('formtr').style.display = "";

document.getElementById('texttr').style.display = "none";

}else if(fel == 'text'){

document.getElementById('formtr').style.display = "none";

document.getElementById('texttr').style.display = "";

}

 

}

</script>

Well seeing as though I don't know ajax and im pretty sure that the server i'll be running this site on doesn't have the ajax capabilities, i'm pretty sure there would be at least one page refresh at the end of the submit process which would in turn get rid of the form...  i'm just not sure about the javascript or div statements -- i had something similar for my FAQ's but i've seemed to have lost that piece of code....

 

Thank you much for that code sample jitesh -- i will give it a try and see if I can get it to work...  Again I appreciate the help.

Ahh well see that I had no clue about...  If the code sample that jitesh doesn't happen to work for me, perhaps I Will look into doing some things with ajax -- and if you could possibly point me into a direction on where I could find some information about AJAX, that would be helpful.

 

Again Thank you all for your help I appreciate it much.

Genericnumber1 -- the AJAX suggestion was awesome, i started reading on ajax and everything and I wrote some code to edit in place, and it's freaking awesome! i love it, thank you for your suggestion, and thank you everyone for the help on this...

 

This here is DEFINATELY solved.

ajax isn't language, it's just a mixture of javascript and PHP. So if you can do PHP, ajax is completely possible - and quite easy with all the javascript libraries out there.

NO That concept is wrong

ajax isn't Javascript its Like Javascript.And its compleately Client side thing Ajax Cant do anything in server side. So there is No matter of PHP in AJAX you can run any language in server side.

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.