How do you make a form, that shows another part, dependent wich radio button you choose?
And another question: Can javascript correspondends with php?
And the last question: How do you show such a "code area" wich you see by using a generator
How do you make a form, that shows another part, dependent wich radio button you choose?
And another question: Can javascript correspondends with php?
And the last question: How do you show such a "code area" wich you see by using a generator
1. You can use javascript for this, say if your form name was myform, and your radio button was called myradio
You could use the DOM to access the values and then write it onto to page like this
You can get some information on how it works from hereCode:if(document.myform.myradio.checked){document.write("You have checked the radio button")}
http://www.w3schools.com/htmldom/dom_obj_form.asp and here
http://www.w3schools.com/htmldom/dom_obj_radio.asp
(This assumes you know basic javascript though)
2. Yes there are two ways for Javascript to communicate with PHP, you can send information by refreshing the page and sending along GET and POST Values (Like by using Javascript to fill out a hidden form and send it to the current page refreshing the page while giving the PHP script the new values) that the PHP can read, the PHP can then echo back information to the javascript.
Another newer way is to use AJAX which lets PHP and Javascript communicate in real time but it's quite complicated
3. I don't understand this question, could you clarify or give an example?
Like on this site when you click the code button, how you make something like that in html/javascript.Originally Posted by narako
I hope this clear enough.
Thanks for the other answers:thumbup:
yea .. ur questions can easily b solved ..Originally Posted by kamustra
ur question :: How do you make a form, that shows another part, dependent wich radio button you choose?
Answer :: I think u can do it wid the help of wid the Java Script ... this can b like tht wen ever u select tht particular ... radio button the particular depended form can b just opened ..
Can javascript correspondends with php?
hmm .. i dunno much abt php .. well even though i guess tht it does support javascript ...
For the code area, if you just wanted something that looked like this
on a normal page, you can use the div tags and either HTML of CSS to set it at a fixed length and give it a background color and border that makes it look code box like.Code:Woot there's some code here and stuff
However if you want something like this
You can do it with javascript using regular expressions and a really long tedious process of defining every single possible thing to highlight or you can download and use one of the premade syntax highlighting scripts on the internet (which is highly recomended)PHP Code:echo("Look all my code here is colored and stuff for me")
Where I can found that premade syntax highlighting scripts??
Maybe it could be helpfull.
But what I mean is a textarea, where users can copy the code they need.
Or is it just something like this
Code:<form><textarea>Code here </textarea></form>
Well if you don't want syntax highlighting then yes something like that will do just fine. If you do however there are some options, I'm not to sure about some but PHP has a built in PHP Highlighter using the highlight_string() function.
Also there is a PEAR Package called text_highlighter that can highlight a lot of different languages including HTML, CSS, Javascript, and PHP
It's available here
http://www.pear.php.net/package/Text_Highlighter/
All of these require some knowledge of PHP programming though
Bookmarks