dennismonsewicz Posted September 30, 2008 Share Posted September 30, 2008 Can you post information that is inside a div? For example: If i have a div like so: <div id="test">This is a test</div> Can I post it using this: $test = $_POST['test']; echo $test; Just wondering... Quote Link to comment Share on other sites More sharing options...
F1Fan Posted September 30, 2008 Share Posted September 30, 2008 No, but you could use a hidden input: <div id="test">This is a test</div> <input type="hidden" name="test" value="This is a test"> And if the text inside the div was dynamic, you could use a little JavaScript to copy it to the hidden input. Quote Link to comment Share on other sites More sharing options...
dennismonsewicz Posted September 30, 2008 Author Share Posted September 30, 2008 thanks! Quote Link to comment Share on other sites More sharing options...
dennismonsewicz Posted September 30, 2008 Author Share Posted September 30, 2008 is there any other way of doing this besides placing the content inside a hidden input? Quote Link to comment Share on other sites More sharing options...
F1Fan Posted September 30, 2008 Share Posted September 30, 2008 List your applicable code and describe exactly what you're trying to do. Another option would be to use a text area that you format heavily with CSS, but there may be other options if I know what you're trying to do. Quote Link to comment Share on other sites More sharing options...
dennismonsewicz Posted September 30, 2008 Author Share Posted September 30, 2008 its kind of confusing but here goes... Here is the code: echo '<div class="left-list" id="left-list">'; echo '<div><input type="checkbox" name="pm1" class="checkbox" id="pm1" /> <label for="pm1">PM</label></div>'; echo '<div><input type="checkbox" name="designer1" class="checkbox" id="designer1" /> <label for="designer1">Designer</label></div>'; echo '<div><input type="checkbox" name="pm2" class="checkbox" id="pm2" /> <label for="pm2">PM</label></div>'; echo '<div><input type="checkbox" name="writer" class="checkbox" id="writer" /> <label for="writer">Writer</label></div>'; echo '<div><input type="checkbox" name="pm3" class="checkbox" id="pm3" /> <label for="pm3">PM</label></div>'; echo '<div><input type="checkbox" name="designer2" class="checkbox" id="designer2" /> <label for="designer2">Designer</label></div>'; echo '<div><input type="checkbox" name="pm4" class="checkbox" id="pm4" /> <label for="pm4">PM</label></div>'; echo '<div><input type="checkbox" name="christine" class="checkbox" id="christine" /> <label for="christine">Christine</label></div>'; echo '<div><input type="checkbox" name="pm5" class="checkbox" id="pm5" /> <label for="pm5">PM</label></div>'; echo '<div><input type="checkbox" name="designer3" class="checkbox" id="designer3" /> <label for="designer3">Designer</label></div>'; echo '<div><input type="checkbox" name="pm6" class="checkbox" id="pm6" /> <label for="pm6">PM</label></div>'; echo '<div><input type="checkbox" name="julie" class="checkbox" id="julie" /> <label for="julie">Julie</label></div>'; echo '<div><input type="checkbox" name="pm7" class="checkbox" id="pm7" /> <label for="pm7">PM</label></div>'; echo '<div><input type="checkbox" name="designer4" class="checkbox" id="designer4" /> <label for="designer4">Designer</label></div>'; echo '<div><input type="checkbox" name="pm8" class="checkbox" id="pm8" /> <label for="pm8">PM</label></div>'; echo '<div><input type="checkbox" name="proofreading" class="checkbox" id="proofreading" /> <label for="proofreading">Proofreading</label></div>'; echo '<div><input type="checkbox" name="pm9" class="checkbox" id="pm9" /> <label for="pm9">PM</label></div>'; echo '<div><input type="checkbox" name="layne" class="checkbox" id="layne" /> <label for="layne">Layne</label></div>'; echo '<div><input type="checkbox" name="pm10" class="checkbox" id="pm10" /> <label for="pm10">PM</label></div>'; echo '<div><input type="checkbox" name="programming" class="checkbox" id="programming" /> <label for="programming">Programming</label></div>'; echo '<div><input type="checkbox" name="pm11" class="checkbox" id="pm11" /> <label for="pm11">PM</label></div>'; echo '<div><input type="checkbox" name="testing" class="checkbox" id="testing" /> <label for="testing">Testing</label></div>'; echo '</div>'; At work we have a project board that has all of our project names and the names of the designers/project managers/marketers/whoever to see where a project is and where it as to go. They have asked me to make this into an online version. I was just trying to simplify my checking to see if any of the checkboxes had been checked verses checked each one. Quote Link to comment Share on other sites More sharing options...
F1Fan Posted September 30, 2008 Share Posted September 30, 2008 Do you have the ability to change the checkbox names? If so, this could be real easy. If not, it might be a little more complicated, but I think it's still feasible. If you can change the names, I would change all of them to something like: <?php echo '<div><input type="checkbox" name="checkboxes[pm1]" class="checkbox" id="pm1" /> <label for="pm1">PM</label></div>'; echo '<div><input type="checkbox" name="checkboxes[designer1]" class="checkbox" id="designer1" /> <label for="designer1">Designer</label></div>'; ?> Then you can just do a check like this: <?php foreach ($_POST['checkboxes'] as $key=>$val){ whatever... } ?> Quote Link to comment Share on other sites More sharing options...
dennismonsewicz Posted September 30, 2008 Author Share Posted September 30, 2008 Yes, I have free reign over the names of the inputs. The names are the easiest way I could come up with to correspond with the sql table. Are you suggesting saving the names in an array called checkboxes? Quote Link to comment Share on other sites More sharing options...
F1Fan Posted September 30, 2008 Share Posted September 30, 2008 Exactly. If you change all the names like I suggested, then the $_POST['whateveryouchoose'] variable will be an array. Just grab all the keys in that array, and there's all your checked values! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.