PHP - A List, Where You Can Move Positions Of List Items.. Hmm
How hard would something like this be? I have a database with all my users.
I need an empty list and when a user clicks a button "Add me to the list" they are added to the first position in the list Slots 1. Tom 2. 3. 4. 5. Later, Jerry wants to be added to the list. So this happens Slots 1. Jerry 2. Tom 3. 4. 5. More people join the list 1. Bob 2. John 3. Jerry 4. Tom 5. Tom gets upset clicks the same button to join the list again, and he's bumped back up to first place. Slots 1. Tom 2. Bob 3. John 4. Jerry 5. Is this possible? And is so, how would I go about getting started on such a thing? I've been using PHP for about a year and a half. Similar TutorialsHi first tyvm for reading my help request me and my friend ar trying to build a order form (see png file ^^) so the main idea is some on go to order form.php
in that order form they fil in thear info like name, adress you know ^^
thean here is the treaky part at the and of the form they kan add products to there order by selecting it or search it from the drop down list the items in the dropdown list come from msql
the client can add more or delete items by clicking - or + whean the clint click send the client need to get a mail whit there a list of what theay have orderd and there unic order number wel so far we can do that but we wont to send another list to the company of order where the added products in the order ar sorted out based on the product id number
this is what we have so far http://clientconstru...sion.nl/valeri/
tyvm again voor anyone who read this ^^
Attached Files
bestel-form.png 37.78KB
0 downloads I coded the following but some parts are not working (the "curveball" mentioned at the end). How would YOU do this? I have a page (A) displaying a form with a textarea field using a WYSIWYG interface. The user will enter a list of unordered items and upon submit the string will look something like this: This is my list of food items: <ul> <li> Lettuce </li> <li> Tomatoes </li> <li> Eggs </li> <ul> Upon submit, I need to give each list item an unique id and store this id along with the text next to it in a separate table: List_item_id List_item_text List_item_state food_1 Lettuce food_2 Tomatoes food_3 Eggs The user will then land in another page with a form displaying the list. The text is now in the page itself and not in a textarea. Instead of the bullets a dropdown list appears, and the user can select "buy" or "sell" for each list item. This page (B) looks something like this: <form> This is my list of food items: <br><select name="food_1"> <option value="buy">Buy</option> <option value="sell">Sell</option> </select> Lettuce <br><select name="food_2"> <option value="buy">Buy</option> <option value="sell">Sell</option> </select> Tomatoes <br><select name="food_2"> <option value="buy">Buy</option> <option value="sell">Sell</option> </select> Eggs <input type=submit value="submit"> </form> When the user hits "submit" the table with the list items will be updated with the values selected in the dropdown list: List_item_id List_item_text List_item_state food_1 Lettuce Buy food_2 Tomatoes Buy food_3 Eggs Sell The next time the user goes to Page B the list will remember the states. Here's the curveball: At any point the user may click on "EDIT LIST" on Page B so they may add more items (at the begining, middle or end of the string). On edit mode the list items should appear as bullets again inside the WYSIWYG interface. Keep in mind that some of the text in the string may not be a list item (ie, "this is my list of food...") Hello! We our creating an admin page to display a list of all the items within a mysql database, these items are within a table called "item". Each item is categorized, these categories are in a table called "category" each category has an ID. There is then a table called "links" which links the items to their category using ID's. We want to display each item by their category with an edit and delete button. We have it so all the items display with the two buttons in no specific order however we are not too sure how to make it so they all display via their category. Here is the code we are currently using: Code: [Select] <?php $itemlist = mysql_query("SELECT item.item_name, item.item_description, item.item_image, item.item_price, item.item_id FROM item ORDER BY item.item_id ASC"); $item_count = 0; ?> <?php while( $row = mysql_fetch_array($itemlist) ){?> <?php if(($row['item.item_name'] == 1) && (isset($item_count) && $item_count < 1)) { ?> <?php $item_count ++; } ?> <li class="title"> <h3><?php echo $row['item_name'];?></h3><br /> <form action="ourworkadmin.php" method="get"> <input type="hidden" name="item_id" value="<?php echo $row['item_id'];?>" /> <input name="edit" value="Edit" type="submit" /> <input name="remove" value="Remove" type="submit" /> </form> </li> <?php } ?> </ul> <!--Close-items_list--> </div> Any help would be appreciated! Thank you!!! Hi. I will try and explain simply.
I have a list of item codes eg.
size1 Acolor1
size1 Bcolor3
size1 Bcolor1
size1 Acolor3
size1 Acolor4
size2 Acolor1
size3 Bcolor1
size3 Bcolor2
size3 Bcolor2
size3 Acolor1
I want to take these and split them into parts:
size1 Acolor2
size1 Bcolor3
etc.
Then I want to create a form with 2 dropdowns. The first option would just have all unique sizes so:
size1
size2
size3
Then when one is selected, option 2 would show the colours available in that size.
Is there a standard way of doing this? Can I use PHP to create the array and then jquery to display and hide the options?
I'm totally stuck and i'm not just looking for somebody to code it all for me. any help would be greatly appreciated
thanks
Sam
Hi, In my mysql database i have a text input option, in the registration form and edit my details form i have a multiple select dropdown list, which user selects options to populate the text input box, which ultimately populates the text field in the mysql database. All works perfectly. The dropdownlist consists of 3 parts <optgroups> first is current selection (what is the usesr current selection)works fine, The second <optgroup> is existing words, what words we(the site) have given as options, and the third <optgroup> is the words that others have used. This is where im having a small problem. Because its a text field when i call the data from the database, it calls the entire text box as a single option in my select list.. I want to break the words in the text field (at the comma) and have them listed each one as an option in the select list. Example what i need: Words in text box:(my input allows the "comma") word1, word2, word3, word4, word5, word6, How i want them called/displayed: <option value=\"word1\">word1</option> <option value=\"word2\">word2</option> <option value=\"word3\">word3</option> <option value=\"word4\">word4</option> <option value=\"word5\">word5</option> <option value=\"word6\">word6</option> here's my code: $query = "SELECT allwords FROM #__functions_experience WHERE profile_id = '".(int)$profileId."' LIMIT 1"; $original_functionsexperience =doSelectSql($query,1); $query = "SELECT allwords FROM #__functions_experience WHERE profile_id = '".(int)$profileId."' LIMIT 1"; $functionsexperiencelist=doSelectSql($query); $funcexpList ="<select multiple=\"multiple\" onchange=\"setFunctionsexperience(this.options)\">"; foreach ($functionsexperiencelist as $functionsexperienceal) { $selected=""; if ($functionsexperienceals->allwords == $original_functionsexperience) $selected=' selected="selected"'; $allwords=$functionsexperienceal->allwords; $funcexpList .= "<optgroup label=\"Current selection\"> <option value=\"".$allwords."\" ".$selected." >".$allwords."</option> </optgroup> <optgroup label=\"Existing Words\"> <option value=\"existing1,\">existing1</option> <option value=\"existing2,\">existing2</option> <option value=\"existing3,\">existing3</option> <option value=\"existing4,\">existing4</option> <option value=\"existing5,\">existing5</option> <option value=\"existing6,\">existing6</option> </optgroup> <optgroup label=\"Others added\"> //heres problem <option value=\"".$allwordsgeneral."\">".$allwordsgeneral."</option> </optgroup>"; } $funcexpList.="</select>"; $output['FUNCEXPLIST']=$funcexpList; The result im getting for optgroup others added: word1, word2, word3, word4, word5, how can i get it like this: <option value=\"word1\">word1</option> <option value=\"word2\">word2</option> <option value=\"word3\">word3</option> <option value=\"word4\">word4</option> <option value=\"word5\">word5</option> <option value=\"word6\">word6</option> Hi , I have one question .. Can I split showing of content of dynamic list in 2 parts , when I echo list in code .. Code: [Select] <?php // Run a select query to get my letest 8 items // Connect to the MySQL database include "../connect_to_mysql.php"; $dynamicList = ""; $sql = mysql_query("SELECT * FROM products ORDER BY date_added DESC LIMIT 8"); $productCount = mysql_num_rows($sql); // count the output amount if ($productCount > 0) { while($row = mysql_fetch_array($sql)){ $id = $row["id"]; $product_name = $row["product_name"]; $price = $row["price"]; $date_added = strftime("%b %d, %Y", strtotime($row["date_added"])); $dynamicList .= '<table width="100%" border="2" cellspacing="2" cellpadding="2"> <tr> <td width="17%" valign="top"><a href="product.php?id=' . $id . '"><img style="border:#666 1px solid;" src="inventory_images/' . $id . '.jpg" alt="' . $product_name . '" width="77" height="102" border="2" /></a></td> <td width="83%" valign="top">' . $product_name . '<br /> $' . $price . '<br /> <a href="product.php?id=' . $id . '">View Product Details</a></td> </tr> </table>'; } } else { $dynamicList = "We have no products listed in our store yet"; } mysql_close(); ?> Code: [Select] <p><?php echo $dynamicList; ?><br /> </p> It works ok, and putting my files, everything works, but when I put 8 pictures with price and other details, it just show one image with details and another image below with details, and the third image below and so on .. Can I split dynamic list to show 4 images with details on the left side and 4 on the right side? Thank you in advance for help , if is possible Hi, I use the following code to create a select menu from an array of options stored in LISTS.php: include 'LISTS.php'; print('<select id="from" name="from">'); foreach ($langList as $lang) {printf('<option %s>%s</option>', ($from1 == $lang ? 'selected="selected"' : ''), $lang); } echo '</select>'; where LISTS.php includes the following: $langList = array(' ','English', 'French', 'German', 'Dutch', 'Spanish'); This works great, but now I want to do something similar with a checkbox list, where each checkbox has an associated 'onchange' javascript function and I'm getting pretty stuck. My checkbox list is of the following form: Code: [Select] <html> <ul style="height: 95px; overflow: auto; width: 200px; border: 1px solid #480091; list-style-type: none; margin: 0; padding: 0;"> <li id="li1b"><label for="chk1b"><input name="chk1b" id="chk1b" type="checkbox" onchange="function1('chk1b','li1b')">Option1</label></li> <li id="li2b"><label for="chk2b"><input name="chk2b" id="chk2b" type="checkbox" onchange="function1('chk2b','li2b')">Option2</label></li> //etc. </ul> </html> What I want to do is have 'Option1', 'Option2', etc. stored in an array in LISTS.php and have a PHP script that populates the checkbox list accordingly, in a similar manner to my select menu above. I can't work out how to get the ID of the next <li> and the next <input> in the list to go up by one each time, e.g. 'li1b' then 'li2b', 'li3b', etc. Could someone pls help me out? Thanks! Is there a way to take data that is listed like a,b,c,d,e and turn that into an unordered list? Basically, I'm going to have a list of schools that will be listed with comma separators. I'll print that data out in two places, one will be printed as it's in the database. The other I would like to echo as an unordered list. PHP script return 20Â UL LISTÂ values like, < ul >
A < /ul > How to display UL LIST into row wise 5 columns like
A B C D Is it possible to get bittorrent peer list (IP list) via php, udp protocol ? txh! Hello there, this is a really noob question, but I've no idea on how to make it work without making everything messy and crappy. I have one SQL table called categories, and another called subcategories. Inside the subcategories table there's a field named 'parent' that will link it to the correspondent category, so it should look something like this in html: Code: [Select] <ul> <li>Category <ul> <li>Subcategory</li> </ul> </li> </ul> Would you please give this poor guy a hand? =) Hey, I'm having a issue with using a listbox.. Am I doing something wrong?? Heres my HTML: Code: [Select] <select style="height:100px;width:250px;" name="countries[]" multiple> <option value="US">United States</option> <option value="UK">United Kingdom</option> <option value="CA">Canada</option> <option value="AU">Australia</option> </select> and my PHP: $countries = $_POST['countries']; $countries = implode(' | ', $countries); I'm trying to set it up so I can insert the data as: US | UK | CA. But, when I submit the form, I get these errors: Quote Notice: Undefined index: countries in /Applications/MAMP/htdocs/mynewscript/admin/cp/add.php on line 30 Warning: implode() [function.implode]: Invalid arguments passed in /Applications/MAMP/htdocs/mynewscript/admin/cp/add.php on line 31 Thanks in advance! Hi , i am trying to make a to do list where i can add things i still need to do . i also want to remove items from the list when they are done , this is what i made now but it still misses a lot , my array keeps getting emptied when i add something.
im still a beginner in php. This is the file without the css included , i don't think it's relevant to this question to include it.
<?php hi guys, i made this code list US states in six columns....the problem is that it lists it across rather than down it lists it like thi Alabama Alaska Arizona blah1 blah2 blah3 blah4 blah5 blah6 when I want it to list like this Alabama blah2 Alaska blah3 Arizona blah 4 blah1 blah5 but not just two columns....I want 4 columns here is my code $query = mysql_query("SELECT * FROM states ORDER BY name ASC"); echo '<center><table width="250" border="0" cellpadding="5" cellspacing="0"> <tr>'; while($show = mysql_fetch_array($query)) { $column = 1+$column; if($column == 6) { $column = '1'; $break = '</td></tr>'; } else { $break = ''; } echo '<td> <table > <tr class="style5"> <td width="50%" align="left" height="23" nowrap>'.$show['name'].'</td> <td height="23" valign="middle" > </td> </tr> </table> '.$break.''; } echo '</table></center>'; I have email's in mysql... how do i automatically send emails every week. I know how to send mail with php. How do i automatically send it every week? I am working on a podcast list script. It displays the results of my mysql query correctly, but shows the results in 1 long list. Code: [Select] $query3 = "SELECT * FROM podcasts WHERE show_id = $show_id ORDER BY airdate DESC"; $result3 = mysql_query($query3) or die(mysql_error()); I would like to further filter the results instead of 1 hugely long list. For example, view by year, month etc... The 'airdate' is stored in the database as DATETIME. Is there a way to seperate the parts of the date: year, month, day using php ?? And if so how would I go about displaying only the podcasts for a specific year or month etc. ?? website located at http://www.eliteweboffers.com/lwr/podcasts.php Thanks. Say i was going to store a "friends list" for a user. Would it be easier to store the names in a text string in the db instead of having to make a new field for each friend? In other words: 001 | Keith | Joe, Jane, Mike or 001 | Keith | Joe | Jane | Mike It seems like a pain to make a column for each but since i'm only 6 months into php i haven't really tapped into it's ability to deal with a string of data. My end game would to at some point take the user list and make a selectable table: Friends: Joe Jane Mike Preferably with an array pseudo coded as: Count how many users for each user echo username <a href username's page> Bottom line: Store as Columns or String? p.s. i've reviewed php.net etc. so it's not a matter of not knowing how but more which is preferable Hello All, i am trying to figerout how can i create a list of options that the user can input the values to as many lines as he wants and then getting the value of each row and inserting it to my DB (mysql) i havent found anyway to make this kind of list that is "open" for edit and is not limited... Can anyone suggest anything ? friends i got my subcats stores like this subcat_id subcat_name id_cat 1 name 1 and i fetch them like this Code: [Select] function getAllSubcategoryWithPrimaryCategory() { $subcategories = array(); $sql =" SELECT c.cat_name, sc.id_subcat, sc.subcat_name FROM `categories` AS c INNER JOIN subcategories AS sc ON c.id_cat = sc.id_cat order by c.cat_name asc , sc.subcat_name "; $rs = executeSql($sql); while($row = mysql_fetch_array($rs)) { $subcategories[] = $row; } return $subcategories; } now the thing is i have stored names like a b c d e f g h i j k l m n o p q other category but results are like this a b c d e f g h i j k l m n o other category p q Acending ways but i wish for the other category to show at the end of every subcategorym how could i get that done? Hey guys I need some help, Im trying to generate a numbered list by using i++ and an if statement but I cant seem to get the values to start over to 0, here is a look at my code Code: [Select] $make = "SELECT * FROM category_description ORDER BY category_id ASC LIMIT 1000"; $makeresult = mysql_query($make); while($make1 = mysql_fetch_array($makeresult)){ $parent = "SELECT * FROM category WHERE parent_id = {$make1['category_id']} LIMIT 1000"; $parentresult = mysql_query($parent); while($parent1 = mysql_fetch_array($parentresult)){ if(($make1['category_id'] == $parent1['parent_id']) AND ($make1['name'] == $make1['name'])){ $i += 1; $count = $i; echo "[". $count . "]" . " " . $parent1['category_id'] . " " . $make1['category_id'] . " " . $parent1['parent_id'] . " " . $make1['name'] . "<br />"; Basically the output comes out like this: Code: [Select] [1] 100 10 10 Acura [2] 101 10 10 Acura [3] 102 10 10 Acura [4] 103 10 10 Acura [5] 104 10 10 Acura [6] 105 10 10 Acura [7] 106 10 10 Acura [8] 107 10 10 Acura [9] 108 10 10 Acura [10] 109 10 10 Acura [11] 110 10 10 Acura [12] 111 10 10 Acura [13] 112 10 10 Acura [14] 113 10 10 Acura [15] 114 10 10 Acura [16] 115 10 10 Acura [17] 116 10 10 Acura [18] 117 10 10 Acura [19] 118 10 10 Acura [20] 119 10 10 Acura [21] 120 10 10 Acura [22] 121 10 10 Acura [23] 122 10 10 Acura [24] 123 10 10 Acura [25] 124 10 10 Acura [26] 125 10 10 Acura [27] 126 11 11 Audi [28] 127 11 11 Audi [29] 128 11 11 Audi [30] 129 11 11 Audi [31] 130 11 11 Audi [32] 131 11 11 Audi [33] 132 11 11 Audi [34] 133 11 11 Audi [35] 134 11 11 Audi [36] 135 11 11 Audi [37] 136 11 11 Audi [38] 137 11 11 Audi But I need it to come out like this, so basically if Acura = Acura generate 1,2,3,4 etc and if Audi = Audi generate 1,2,3,4......Im still somewhat new to this would really appreciate the help if someone can point me in the right direction: Code: [Select] [1] 100 10 10 Acura [2] 101 10 10 Acura [3] 102 10 10 Acura [4] 103 10 10 Acura [5] 104 10 10 Acura [6] 105 10 10 Acura [7] 106 10 10 Acura [8] 107 10 10 Acura [9] 108 10 10 Acura [10] 109 10 10 Acura [11] 110 10 10 Acura [12] 111 10 10 Acura [13] 112 10 10 Acura [14] 113 10 10 Acura [15] 114 10 10 Acura [16] 115 10 10 Acura [17] 116 10 10 Acura [18] 117 10 10 Acura [19] 118 10 10 Acura [20] 119 10 10 Acura [21] 120 10 10 Acura [22] 121 10 10 Acura [23] 122 10 10 Acura [24] 123 10 10 Acura [25] 124 10 10 Acura [26] 125 10 10 Acura [1] 126 11 11 Audi [2] 127 11 11 Audi [3] 128 11 11 Audi [4] 129 11 11 Audi [5] 130 11 11 Audi [6] 131 11 11 Audi [7] 132 11 11 Audi [8] 133 11 11 Audi [9] 134 11 11 Audi [10] 135 11 11 Audi [11] 136 11 11 Audi [12] 137 11 11 Audi |