Jump to content
xisto Community
Sign in to follow this  
kokushta

Help me create a PHP e-Classroom How do I do it ?

Recommended Posts

I want to create a page where you can try and test HTML code, which I'd like to call it 'e-Classroom'. The design will simple as this (see the pic).

 

Posted Image

 

My idea is:

 

the Worksheet will be a textarea containing HTML code and I want to parse that code to the Preview space, using a Submit button.

 

Any idea how to do that?

Share this post


Link to post
Share on other sites

Umm.. how about reading the whole content of the textbox into an array using php and then use the php "echo" command to spit it out as html in the neighbouring box.. but as an inbetween step you have to implement some really strong html syntax checking - or else the translated code would get dumped as pure code in case even one tag is missing.. but in a way that would work out to the learners advantage - he'll know where it's gone wrong..give it a try.. damned good idea.. if you need more elaboration on this - i'm around :Pall the best

Share this post


Link to post
Share on other sites

here is the page to see it, but i get an error msg:

if you need the files, send me an e-mail ok?

the php file contains:

<? phpprint $html;?>

where $html is the textarea name.

I know very a little about php, so help it is always appriciated:)

Share this post


Link to post
Share on other sites

Using php to echo it back might be a little dangerous if the users used some malicious php code... Unless you can echo it back in ' quotes instead of ". I don't know how to do that though.

<html><head><title>eClassroom</title></head><body>e-Classroom<br><br><table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" height="636">  <tr>    <td width="50%" height="30">Worksheet</td>    <td width="50%" height="30">Preview</td>  </tr>  <tr>    <td width="50%" height="606" valign="top">    <form method="POST" action="<? echo $php_self ?>">      <textarea rows="35" name="worksheet" cols="55"><?php echo $worksheet ?></textarea>      <input type="submit" value="Submit" name="submit" style="float: right">    </form></td>    <td width="50%" height="606" valign="top"><?php echo $worksheet ?></td>  </tr></table></body></html>

That might work. Bye.

Share this post


Link to post
Share on other sites

here is the page to see it, but i get an error msg:

 

if you need the files, send me an e-mail ok?

 

the  php file contains:

 

<? phpprint $html;?>

where $html is the textarea name.

 

I know very a little about php, so help it is always appriciated:)

<{POST_SNAPBACK}>


Can you zip up the files and post them here - maybe if I take a look and see the actual thing I could help you figure out a way.. Thanks :P

Share this post


Link to post
Share on other sites

what spuz said, but:you shouldn't echo $worksheet, but $_POST["worksheet"]instead of <form method="POST" action="<? echo $php_self ?>"><textarea rows="35" name="worksheet" cols="55"><?php echo $worksheet ?></textarea><input type="submit" value="Submit" name="submit" style="float: right"></form></td><td width="50%" height="606" valign="top"><?php echo $worksheet ?></td></tr>go for this: <form method="POST"><textarea rows="35" name="worksheet" cols="55"><?php echo $_POST["worksheet"]; ?></textarea><input type="submit" value="Submit" name="submit" style="float: right"></form></td><td width="50%" height="606" valign="top"><?php echo $_POST["worksheet"]; ?></td></tr>that should work.

Share this post


Link to post
Share on other sites

What you want is something like W3Schools has in its tutorial pages. This is a link which shows what you want it to look like : http://www.w3schools.com/css/tryit.asp?filackground-color

 

I am not sure of any other ways except the ones which others have mentioned here. Is it just gonna be testing ONLY html & css not PHP or any other language? The simplest

way to do this is to remove the languages tags like : <script><php> etc.

 

This is a very basic way and it shouldn't enable any other language because the tags

have been removed.

 

It shouldn't be hard to do all you have to do is get the code from the worksheet and

show it in the Preview box, basically like everyone and you have said.

Share this post


Link to post
Share on other sites

What you want is something like W3Schools has in its tutorial pages. This is a link which shows what you want it to look like : http://www.w3schools.com/css/tryit.asp?filackground-color

 

I am not sure of any other ways except the ones which others have mentioned here. Is it just gonna be testing ONLY html & css not PHP or any other language? The simplest

way to do this is to remove the languages tags like : <script><php> etc.

 

This is a very basic way and it shouldn't enable any other language because the tags

have been removed.

 

It shouldn't be hard to do all you have to do is get the code from the worksheet and

show it in the Preview box, basically like everyone and you have said.

<{POST_SNAPBACK}>

Yeah, that's the exact thing I wanted. I was inspired by it, I just had that in mind, but I could not remember it was from W3School site. I want to create a similar thing, but in my language, so I can help my country youth to learn HTML.

 

But you smt you need some support, sm1 to share thoughts and I think, here (no brushes at all) I have found a very friendly, ready to help ppl.

 

I've been busy these days, you know (for those who are still studying), exams!!

 

I dont give up easy, and if I achieve smth, I'd like to share it with you.

 

Now sm1 could, yeah yeah very touchy, but cut it off.:P So, hear us soon.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | 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.