dennismonsewicz
Members-
Posts
1,136 -
Joined
-
Last visited
Everything posted by dennismonsewicz
-
I have this code: <?php include "includes/sql.php"; $action = $_GET['action']; switch($action) { case "foreach": echo '<form action="foreach.php?action=results" method="post">'; echo '<div><input type="checkbox" name="checkboxes[pm1]" class="checkbox" id="pm1" value="1" /> <label for="pm1">PM</label></div>'; echo '<div><input type="checkbox" name="checkboxes[designer1]" class="checkbox" id="designer1" value="1" /> <label for="designer1">Designer</label></div>'; echo '<div><input type="checkbox" name="checkboxes[pm2]" class="checkbox" id="pm2" value="1" /> <label for="pm2">PM</label></div>'; echo '<div><input type="checkbox" name="checkboxes[writer]" class="checkbox" id="writer" value="1" /> <label for="writer">Writer</label></div>'; echo '<div><input type="checkbox" name="checkboxes[pm3]" class="checkbox" id="pm3" value="1" /> <label for="pm3">PM</label></div>'; echo '<div><input type="checkbox" name="checkboxes[designer2]" class="checkbox" id="designer2" value="1" /> <label for="designer2">Designer</label></div>'; echo '<div><input type="checkbox" name="checkboxes[pm4]" class="checkbox" id="pm4" value="1" /> <label for="pm4">PM</label></div>'; echo '<div><input type="checkbox" name="checkboxes[christine]" class="checkbox" id="christine" value="1" /> <label for="christine">Christine</label></div>'; echo '<div><input type="checkbox" name="checkboxes[pm5]" class="checkbox" id="pm5" value="1" /> <label for="pm5">PM</label></div>'; echo '<div><input type="checkbox" name="checkboxes[designer3]" class="checkbox" id="designer3" value="1" /> <label for="designer3">Designer</label></div>'; echo '<div><input type="checkbox" name="checkboxes[pm6]" class="checkbox" id="pm6" value="1" /> <label for="pm6">PM</label></div>'; echo '<div><input type="checkbox" name="checkboxes[julie]" class="checkbox" id="julie" value="1" /> <label for="julie">Julie</label></div>'; echo '<div><input type="checkbox" name="checkboxes[pm7]" class="checkbox" id="pm7" value="1" /> <label for="pm7">PM</label></div>'; echo '<div><input type="checkbox" name="checkboxes[designer4]" class="checkbox" id="designer4" value="1" /> <label for="designer4">Designer</label></div>'; echo '<div><input type="checkbox" name="checkboxes[pm8]" class="checkbox" id="pm8" value="1" /> <label for="pm8">PM</label></div>'; echo '<div><input type="checkbox" name="checkboxes[proofreading]" class="checkbox" id="proofreading" value="1" /> <label for="proofreading">Proofreading</label></div>'; echo '<div><input type="checkbox" name="checkboxes[pm9]" class="checkbox" id="pm9" value="1" /> <label for="pm9">PM</label></div>'; echo '<div><input type="checkbox" name="checkboxes[layne]" class="checkbox" id="layne" value="1" /> <label for="layne">Layne</label></div>'; echo '<div><input type="checkbox" name="checkboxes[pm10]" class="checkbox" id="pm10" value="1" /> <label for="pm10">PM</label></div>'; echo '<div><input type="checkbox" name="checkboxes[programming]" class="checkbox" id="programming" value="1" /> <label for="programming">Programming</label></div>'; echo '<div><input type="checkbox" name="checkboxes[pm11]" class="checkbox" id="pm11" value="1" /> <label for="pm11">PM</label></div>'; echo '<div><input type="checkbox" name="checkboxes[testing]" class="checkbox" id="testing" value="1" /> <label for="testing">Testing</label></div>'; echo '<input type="submit" value="Submit" />'; echo '</form>'; break; case "results": foreach($_POST['checkboxes'] as $key=>$val) { $qry = mysql_query("INSERT INTO fake ($key) VALUES ($val)") or die(mysql_error()); if($qry) { echo "Check: $key, Value: $val <br />"; } } break; } ?> When I fill out the form it submits but creates individual rows with results and not all of the results in the same row Any help is appreciated!
-
Here is the code: <?php include "includes/sql.php"; $action = $_GET['action']; switch($action) { case "foreach": echo '<form action="foreach.php?action=results" method="post">'; echo '<div><input type="checkbox" name="checkboxes[pm1]" class="checkbox" id="pm1" value="1" /> <label for="pm1">PM</label></div>'; echo '<div><input type="checkbox" name="checkboxes[designer1]" class="checkbox" id="designer1" value="1" /> <label for="designer1">Designer</label></div>'; echo '<div><input type="checkbox" name="checkboxes[pm2]" class="checkbox" id="pm2" value="1" /> <label for="pm2">PM</label></div>'; echo '<div><input type="checkbox" name="checkboxes[writer]" class="checkbox" id="writer" value="1" /> <label for="writer">Writer</label></div>'; echo '<div><input type="checkbox" name="checkboxes[pm3]" class="checkbox" id="pm3" value="1" /> <label for="pm3">PM</label></div>'; echo '<div><input type="checkbox" name="checkboxes[designer2]" class="checkbox" id="designer2" value="1" /> <label for="designer2">Designer</label></div>'; echo '<div><input type="checkbox" name="checkboxes[pm4]" class="checkbox" id="pm4" value="1" /> <label for="pm4">PM</label></div>'; echo '<div><input type="checkbox" name="checkboxes[christine]" class="checkbox" id="christine" value="1" /> <label for="christine">Christine</label></div>'; echo '<div><input type="checkbox" name="checkboxes[pm5]" class="checkbox" id="pm5" value="1" /> <label for="pm5">PM</label></div>'; echo '<div><input type="checkbox" name="checkboxes[designer3]" class="checkbox" id="designer3" value="1" /> <label for="designer3">Designer</label></div>'; echo '<div><input type="checkbox" name="checkboxes[pm6]" class="checkbox" id="pm6" value="1" /> <label for="pm6">PM</label></div>'; echo '<div><input type="checkbox" name="checkboxes[julie]" class="checkbox" id="julie" value="1" /> <label for="julie">Julie</label></div>'; echo '<div><input type="checkbox" name="checkboxes[pm7]" class="checkbox" id="pm7" value="1" /> <label for="pm7">PM</label></div>'; echo '<div><input type="checkbox" name="checkboxes[designer4]" class="checkbox" id="designer4" value="1" /> <label for="designer4">Designer</label></div>'; echo '<div><input type="checkbox" name="checkboxes[pm8]" class="checkbox" id="pm8" value="1" /> <label for="pm8">PM</label></div>'; echo '<div><input type="checkbox" name="checkboxes[proofreading]" class="checkbox" id="proofreading" value="1" /> <label for="proofreading">Proofreading</label></div>'; echo '<div><input type="checkbox" name="checkboxes[pm9]" class="checkbox" id="pm9" value="1" /> <label for="pm9">PM</label></div>'; echo '<div><input type="checkbox" name="checkboxes[layne]" class="checkbox" id="layne" value="1" /> <label for="layne">Layne</label></div>'; echo '<div><input type="checkbox" name="checkboxes[pm10]" class="checkbox" id="pm10" value="1" /> <label for="pm10">PM</label></div>'; echo '<div><input type="checkbox" name="checkboxes[programming]" class="checkbox" id="programming" value="1" /> <label for="programming">Programming</label></div>'; echo '<div><input type="checkbox" name="checkboxes[pm11]" class="checkbox" id="pm11" value="1" /> <label for="pm11">PM</label></div>'; echo '<div><input type="checkbox" name="checkboxes[testing]" class="checkbox" id="testing" value="1" /> <label for="testing">Testing</label></div>'; echo '<input type="submit" value="Submit" />'; echo '</form>'; break; case "results": foreach($_POST['checkboxes'] as $key=>$val) { $qry = mysql_query("INSERT INTO fake ($key) VALUES ($val)") or die(mysql_query()); if($qry) { echo "Check: $key, Value: $val <br />"; } } break; } ?> Ok when I run the code it inserts each check into its own individual row instead of the same row... any help?
-
yes it is a static number... I reckon I was trying to come up with a lazy way of producing the information lol... How would I save the post information into an array and then write a foreach statement that will loop through the results?
-
How would i turn the following code into a foreach statement? 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>';
-
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?
-
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.
-
is there any other way of doing this besides placing the content inside a hidden input?
-
thanks!
-
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...
-
Thanks everyone... I have just seen it used here lately when I am editing smarty templates (which I hate) and I was just curious
-
What is the difference here: $var1 = "SELECT * FROM $tbl_name WHERE id = {$_POST['id']}"; VS $var1 = "SELECT * FROM $tbl_name WHERE id = '" . $_POST['id'] . "'"; Do the { brackets acheive the same as the period?
-
well I am not sure why but its working now...
-
sorry i wasn't thinking... Here is what I got: SELECT * FROM tbl_name WHERE project LIKE '%text%' the name text, '%text%', is the test name i gave the project when I added it.
-
this is what i got Resource id #7
-
The quickest and easiest solution is to just get rid of Novell!!!!!
-
you could use AJAX to accomplish this... I just currently implemented a Drag and drop sortable list using AJAX... It connets to the DB immediately and saves the order
-
Internet Explorer+APache and PHP not working
dennismonsewicz replied to gnawz's topic in PHP Coding Help
make sure you have cookies turned on in IE -
I have this bit of code: $result = mysql_query("SELECT * FROM tbl_name WHERE project LIKE '%" . $project_name . "%'") or die(mysql_error()); $rows = mysql_num_rows($result); if ($rows > 0) { echo '<p>Here is a list of other projects that have similar Project Names:</p>'; while ($name = mysql_fetch_object($result)) { echo '<p><a href="tools.php?action=view&id=' . $name->id . '">' . $name->project . '</a></p>'; } } The above code is supposed to search through the DB when a new project is added and then spit out all project names that have the same or are like the same project that was added... well it is only spitting out the one you just inserted Anyone got any ideas?
-
Sweet it worked! Thanks!
-
I am wanting to grab the name of the page that a user is on. I want to achieve this so I can write an if statement that says if you are on this page then run this particular code. Any ideas on how to do this?
-
just use this LIMIT 12
-
How to use a button to delete MySQL entries...
dennismonsewicz replied to Jamrams's topic in PHP Coding Help
ah I agree with Darkwater... So is that how this forum is doing the post and preview buttons? -
How to use a button to delete MySQL entries...
dennismonsewicz replied to Jamrams's topic in PHP Coding Help
yes you can use php and use an html link that passes the unique ID, but he is wanting to use the html submit input -
How to use a button to delete MySQL entries...
dennismonsewicz replied to Jamrams's topic in PHP Coding Help
I could be wrong, but to achieve this properly you will have to use javascript -
[SOLVED] Session problems still
dennismonsewicz replied to dennismonsewicz's topic in PHP Coding Help
sorry for the bumping saga, I have fixed my issue. I placed the rightnav.php file in the header.php file and everything began working itself out after I weaked some more of the code. Thanks again!