Hi,
I'm trying to create a script that echoes javascript code to a textarea box depending on which checkboxes are selected.
So if all checkboxes are selected, it echoes all the data associated with each checkbox in order.
So far this is what I have:
Code:
<?php
if (isset($_POST['checkbox1'])) {
echo "echo this javascript data to mybox";
}
if (isset($_POST['checkbox2'])) {
echo "echo this javascript data to mybox";
}
?>
<html>
<head>
<title>Script</title>
</head>
<body>
<form name="myform" action="index.php" method="post">
<textarea name="mybox" cols="75" rows="5" wrap="soft">
Data goes here
</textarea>
<input type="checkbox" name="checkbox1" value="checkbox1">
<input type="checkbox" name="checkbox2" value="checkbox2">
<input type="submit" value="Submit" name="submit">
</form>
</body>
</html>
Also, how can I specify that all data is placed between two pieces of data, no matter which checkboxes are selected?
For example:
If both checkboxes are selected, the data from each would always be placed between:
TopData
*data from checkbox1
*data from checkbox2
BottomData
How can I get this to work?
Thanks.