Hi people, i need a litle help with php if you don`t mind..... So thats what i want: got a few checkbox`s on my website. Each of them as corresponded code (not visible for now) After choosing what "i" want i press submit and i need that that page, shows all the codes of each Checked CheckBox in a Text Field Someone know how to do it ?
are you referring to something like this? http://www.roseindia.net/ajax/jquery/multiple-check-box.shtml
BUMP! Using that code how can i make it inside a text area with a small scroll bar I would like to use an background image too Does anyone can help me ?!?
Do you mean that you want to display all the values from the checkboxes in a textarea field? Or just display them on a webpage? I'm a little confused. But if you are asking about showing them in a textarea field, you can just post back to the form with the value of the textarea set to show the post-values from each checkbox - something like this: (pseudocode) <form action="<?php $_SERVER['PHP_SELF']; ?>" method="post"> <input type="checkbox" value="foo" name="checkbox1" /> <input type="checkbox" value="bar" name="checkbox2" /> <input type="checkbox" value="foobar" name="checkbox3" /> <input type="textarea" value="<?php if (isset($_POST['submit'])) { echo $_POST['checkbox1'].$_POST['checkbox2'].$_POST['checkbox3']; } else {} ?>" name="textbox" /> <input type="submit" name="submit" value="submit info" /> PHP: The same can of course be used if you just want to echo the results from the checkboxes to the page - just put the echo-statement from the value into a <p>-tag or something similar
Not that What i want is that after choosing certain checkbox´s the website returns a code to the visitor that will be showed inside a textarea..... One more thing. This page`s code: http://www.roseindia.net/ajax/jquery/multiple-check-box.shtml Only returns the checkbox value ..... How do i make to the script returns the text i want ??
I'm not really sure I understand your problem - the code I posted above does exactly the same as the elaborate jQuery code in the link you posted - of course, the page will reload if you don't use Ajax/javascript for this, but the code itself works just fine. Depending on the values you want returned, you could either make a PHP variable containing whatever you want to be displayed depending on which checkboxes are selected, or just put the whatever you want the checkbox to return into the value="" for each checkbox. I'm assuming you want something like "if checkbox 1 selected return "you selected checkbox 1, which has the following code/text attached to it"" - but not show the actual text in the value-part if the user checks the source-code or something? Hm, I think maybe I misunderstood you a bit - here is another piece of code that does something more like what you want, I think: <form action="<?php $_SERVER['PHP_SELF']; ?>" method="post"> <input type="checkbox" value="foo" name="checkbox1" /> <input type="checkbox" value="bar" name="checkbox2" /> <input type="checkbox" value="foobar" name="checkbox3" /><br /> <textarea cols="35" rows="10" value="<?php if (isset($_POST['submit'])) { if (isset($_POST['checkbox1'])) { $value1 = "This is the value returned from the checkbox #1 if checked"; } echo $value1.$_POST['checkbox2'].$_POST['checkbox3']; } else {} ?>" name="textbox"><?php if (isset($_POST['submit'])) { if (isset($_POST['checkbox1'])) { $value1 = "This is the value returned from the checkbox #1 if checked"; } echo $value1.$_POST['checkbox2'].$_POST['checkbox3']; } else {} ?></textarea> <br /><input type="submit" name="submit" value="submit info" /> PHP: You can find a working test of the example here: http://www.regncon.no/testing/checktest.php