PHP - Passing Array To Option List Help...
I am passing an array to an option list but if a value has two words, the second word doesnt get sent via POST. So if the value should be THE ONE, the word ONE doesnt get sent via POST. Kinda wierd, wondered if there is an easy explanation for this?
Code: [Select] <?php echo '<SELECT name=carrier>'; foreach ($allcar as $key => $value) { echo '<OPTION value=' . $value . '> ' . $value . ''; } echo '</select>'; ?> Similar TutorialsWhat I'm wanting to do is pass the $propertyid = "1"; threw my select value as you can see. so it passes variable so to speak.' Code: [Select] print "<td>Control:<form action=\"dashboard.php\" method=\"GET\" target=\"_self\"> <select name=\"control\" onChange=\"this.form.submit()\"> <option selected></option> <option>Take a Payment</option> <option>Print Ledger </option> <option>-----------------</option> <option value=\"comadd?propid=$propertyid\">Add Communication</option> <option>----------------</option> <option>Modify Property</option> <option>Remote Property</option> </select></td>"; Hey guys, i have a small problemo. As you can see i have made an option list from 0 to 3. How can I put this optionlist in a for loop so I can save some place? I have found an example but I dont know how to integrate it in my php Example Code: [Select] for( $i = 0; $i < 4; $i++ ) { $optionlist .= "<option value=\"$i\">$i</option>\n"; } $optionlist .= "</select>\n"; Code: [Select] <?php $dranken = array("cola", "fanta", "bier", "koffie", "thee"); $prijzen = array("2", "2", "1.80", "2.20", "2.20"); $i = 0; echo "<table>"; while ($dranken[$i]) { $listnaam = $dranken[$i] . "_aantal"; $optionlist = "<select name= '$listnaam'><option>0</option><option>1</option><option>2</option><option>3</option></select>"; echo "<tr><td >" . $dranken[$i] . "</td>"; echo "<td>" . $prijzen[$i] . "</td>"; echo "<td>" . $optionlist . "</td></tr>"; $i++; } echo "</table>"; ?> thanks Quote
I have this code here. i wanted to know how i can be able to make multiple selections from the returned data from the database and how to save them Quote
<select name="troom" multiple class="form-control" required> <option selected="true" disabled="disabled">--Select a room--</option> $records =mysqli_query($con, "select * from room where TRoom not in (select TRoom from roombook where cin <= '$checkout' and cout >= '$checkin');"); while ($data = mysqli_fetch_array($records)) { echo "<option value='" . $data['TRoom'] . "'>" . $data['TRoom'] . "</option>"; //displaying data in option menu } } ?> </select>
Hello. I am working on something where I don't want to do this.... if ($pages <= 1){$P=1;} elseif ($pages > 1 && $pages <= 2){$P=2;} elseif ($pages > 2 && $pages <= 3){$P=3;} elseif ($pages > 3 && $pages <= 4){$P=4;} elseif ($pages > 4 && $pages <= 5){$P=5;} elseif ($pages > 5 && $pages <= 6){$P=6;} elseif ($pages > 6 && $pages <= 7){$P=7;} elseif ($pages > 7 && $pages <= 8){$P=8;} elseif ($pages > 8 && $pages <= 9){$P=9;} elseif ($pages > 9 && $pages <= 10){$P=10;} This could go on and on and I would rather use the for $ i++ for this so it will wright out the coding for as little or as much as it needs rather then I. However I am not sure how I would do this. I also have if ($PN == 1){$L = "0,20";} elseif ($PN == 2){$L = "20,20";} elseif ($PN == 3){$L = "40,20";} elseif ($PN == 4){$L = "60,20";} elseif ($PN == 5){$L = "80,20";} elseif ($PN == 6){$L = "100,20";} were I will need to be able to add 20 to the number. Is this easily done? I'm a bit loss tried a few things and its not working properly. I have a form that contains 3 text fields and 7 populated lists (that are dependent on the choice of the previous lists). When I post the information to MySQL and to my processing page, it posts the table "ids" instead of the selected option. Here's the php code for the form: <form action="gccsuccess_form.php" method="post" enctype="multipart/form-data" name="gcc" id="gcc"> <table width="700" border="0" align="center" cellpadding="3" cellspacing="3"> <tr> <td><label for="date">Today's Date:</label> <input type="text" name="date" id="date"></td> <td> </td> </tr> <tr> <td>Week Number: <select name="week" size="1" id="week"> <option value="0" selected>Week 0 - 3/26 - 4/1</option> <option value="1">Week 1 - 4/2 - 4/8</option> <option value="2">Week 2 - 4/9 - 4/15</option> <option value="3">Week 3 - 4/16 - 4/22</option> <option value="4">Week 4 - 4/23 - 4/29</option> <option value="5">Week 5 - 4/30 - 5/6</option> <option value="6">Week 6 - 5/7 - 5/13</option> </select></td> <td><label for="location"></label> </td> </tr> <tr> <td>Location: <select id='locations' name='location'> </select></td> <td> </td> </tr> <tr> <td><label for="label8">Team Name</label> <select id='team_names' name='team_name'> </select></td> <td> </td> </tr> <tr> <td><em>*Please enter each team member's first and last name:</em></td> <td> </td> </tr> <tr> <td><label for="mem_1"> Team <strong>Captain:</strong></label> <select id='team_members 1' name='capt'> </select></td> <td><label for="label4"><strong>Steps:</strong></label> <input type="text" name="steps_1" id="steps_1"></td> </tr> <tr> <td><label for="mem_2">Team Member #2 <strong>Name: <select id='team_members 2' name='mem_2'> </select> </strong></label></td> <td><label for="label5"><strong>Steps:</strong></label> <input type="text" name="steps_2" id="steps_2"></td> </tr> <tr> <td><label for="mem_3">Team Member #3 <strong>Name: <select id='team_members 3' name='mem_3'> </select> </strong></label></td> <td><label for="label6"><strong>Steps:</strong></label> <input type="text" name="steps_3" id="steps_3"></td> </tr> <tr> <td><label for="mem_4">Team Member #4<strong> Name</strong>: <select id='team_members 4' name='mem_4'> </select> </label></td> <td><label for="label7"><strong>Steps:</strong></label> <input type="text" name="steps_4" id="steps_4"></td> </tr> <tr> <td><label for="label">Team Member #5<strong> Name</strong>: <select id='team_members 5' name='mem_5'> </select> </label></td> <td><label for="label7"><strong>Steps:</strong></label> <input type="text" name="steps_5" id="steps_5"></td> </tr> <tr> <td> </td> <td> </td> </tr> <tr> <td> </td> <td><em>* Maximum steps for each team member per week is <strong>105,000. </strong></em></td> </tr> <tr> <td> </td> <td><input type="submit" name="Submit Form" id="Submit Form" value="Submit"></td> </tr> </table> <label></label> <div align="center"><br> If you have questions about the competition or reporting please contact KC WELLNESS, INC toll free at <SPAN id="lw_1237248942_0">877-634-1412.</SPAN><br> <br> </div> </form> And here's the code for the page it is posted in: <?php $date = $_POST['date']; $week = $_POST['week']; $location = $_POST['location']; $team_name = $_POST['team_name']; $capt = $_POST['capt']; $mem_2 = $_POST['mem_2']; $mem_3 = $_POST['mem_3']; $mem_4 = $_POST['mem_4']; $mem_5 = $_POST['mem_5']; $steps_1= $_POST['steps_1']; $steps_2= $_POST['steps_2']; $steps_3= $_POST['steps_3']; $steps_4 = $_POST['steps_4']; $steps_5 = $_POST['steps_5']; mysql_connect("mysql1.myregisteredsite.com", "49200_kandace", "Leonardo56") or die(mysql_error()); mysql_select_db("49200_GCC") or die(mysql_error()); mysql_query("INSERT INTO `walkathon` VALUES ('$date', '$week', '$location', '$team_name', '$capt','$mem_2','$mem_3', '$mem_4', '$mem_5', '$steps_1','$steps_2', '$steps_3','$steps_4', '$steps_5' )"); Print "Thank you for your entry. <br> Report summary: <br/><br/>"; echo "<strong> Date: </strong> {$date} <br/> <br/><strong> Week: </strong> {$week} <br/> <br/><strong> Location: </strong> {$location} <br/> <br/><strong> Team Name: </strong> {$team_name} <br/> <br/><strong> Team Captain: </strong> {$capt} / <strong> Steps: </strong> {$steps_1} <br /> <br/><strong> Team Member 2 Name: </strong> {$mem_2} / <strong> Steps: </strong> {$steps_2} <br /> <br/><strong> Team Member 3 Name: </strong> {$mem_3} / <strong> Steps: </strong> {$steps_3} <br /> <br/><strong> Team Member 4 Name: </strong> {$mem_4} / <strong> Steps: </strong> {$steps_4} <br /> <br/><strong> Team Member 5 Name: </strong> {$mem_5} / <strong> Steps: </strong> {$steps_5}" ?> How do I get the processing page to echo the selected option instead of the id? Hi, I'll try and keep this brief but it really is a case of searching for needle in a haystack... I've just started working for a UK charity whose main activity is supported by a massive website. Stacks of information sheets, 3 distinct forums (each about the size of Freaks here), numerous blogs, events pages, webinars etc. etc. Essentially, it is an on-line free community that serves the needs of a very sizeable percentage of man and womankind. Like many charities it relies on gratis contributions from those with time or money to spare. I don't have either, but I do believe in what they are doing. The problem is that that the site itself has grown or rather mutated to become a huge data repository, built from a number of contributors with different skills sets and ways of doing things. At the back of it lurks a CMS which staff (a limited number) use to update site content. 95% of the site is in PHP, with a host of other ingredients thrown into the pot (Tiny-MCE, Perl, Ajax, Fancybox, html5, flash, blah and blah). The problem is in the CMS when someone tries to enter a date beyond 2014 there is no option to do so - -.i.e. that's as far as the dropdown goes. I can see the problem but can't find the offending script/files. Anywhere. Here's a snippet from the viewable source for those with keener eyesight:
<form action="index.php?content=data_universal_new&table=events" method="post" ENCTYPE="multipart/form-data" > <input type="hidden" name="change" value=""> <table summary="" border="0"> <tr> <td valign="top">Title</td> <td><input type="text" name="titlex" size="30" maxlength="256" value=""></td> </tr> <tr> <td valign="top">Microsite</td> <td> <select name="micrositex"> <option value="INF UK" > INF UK</option> <option value="MTL" > MTL</option> <option value="ACE BABES" > ACE BABES</option> </select> </td> </tr> <tr> <td valign="top">Short description</td> <td><textarea name="short_descriptionx" cols="40" rows="5" ></textarea></td> </tr> <tr> <td valign="top">Thumbnail</td> <td> <input type="file" name="graphic[thumbnailx]"> <input type="checkbox" name="deletepic[thumbnail]" value="yes"> Delete? </td> </tr> <tr> <td valign="top">Main page</td> <td> <div id="tm"><textarea id="elm1" name="main_pagex" style=" height: 400px;width:460px;" class="mceEditor"></textarea></div> <p> <script type="text/javascript"> function toggleEditor(id) { if (!tinyMCE.getInstanceById(id)) tinyMCE.execCommand('mceAddControl', false, id); else tinyMCE.execCommand('mceRemoveControl', false, id); } </script> <div><a href="javascript:toggleEditor('elm1');">[Add/Remove editor]</a></div> <a href="upload.php" title="Upload Documents" class="iframe">Upload Documents</a> <span class="tooltip" title="Click here to start the document uploader,The documents will be available to link to in the link list drop-down"> <img src="../images/help.png" border="0" width="15" height="15" alt="" align="top" > </span> </p> </td> </tr> <tr> <td valign="top">Date</td> <td> <select name="date[4]"> <option >1</option> <option >2</option> <option >3</option> <option >4</option> <option >5</option> <option >6</option> <option >7</option> <option >8</option> <option >9</option> <option >10</option> <option >11</option> <option >12</option> <option >13</option> <option >14</option> <option >15</option> <option >16</option> <option >17</option> <option >18</option> <option >19</option> <option >20</option> <option >21</option> <option >22</option> <option >23</option> <option >24</option> <option selected>25</option> <option >26</option> <option >27</option> <option >28</option> <option >29</option> <option >30</option> <option >31</option> </select> <select name="date[3]"> <option value="1" >Jan</option> <option value="2" >Feb</option> <option value="3" >Mar</option> <option value="4" >Apr</option> <option value="5" >May</option> <option value="6" >Jun</option> <option value="7" >Jul</option> <option value="8" >Aug</option> <option value="9" >Sep</option> <option value="10" >Oct</option> <option value="11" selected>Nov</option> <option value="12" >Dec</option> </select> <select name="date[5]"> <option value="2002" >2002</option> <option value="2003" >2003</option> <option value="2004" >2004</option> <option value="2005" >2005</option> <option value="2006" >2006</option> <option value="2007" >2007</option> <option value="2008" >2008</option> <option value="2009" >2009</option> <option value="2010" >2010</option> <option value="2011" >2011</option> <option value="2012" >2012</option> <option value="2013" >2013</option> <option value="2014" selected >2014</option> </select> </td></tr> <tr> <td> </td> <td><input type="submit" value="Submit"></td> </tr> </table> </form> </div> <div id="man_div"> <p><a href="index.php?content=data_universal_new&add=yes&table=events">Add event</a></p>Hmm. Any thoughts would be greatly appreciated. Edited by Ch0cu3r, 25 November 2014 - 07:15 AM. Hi, I'm a php newbie, with some mysql experience. I have a mysql database as follows: Database=watch, Table=events - fields id, reportno, sdate, comments What I need is: 1. A dropdown list to display reportno from mysql database. 2. Depending on which reportno I choose, I'd like to open a popup(or separate) page to display the stored information. Tks in advance for any help Hi I have a list of states using the array method in a form. The drop down menu works fine. I want to save the user choice,if the form is re-displayed due to a blank field or pattern mismatch. I know I can use the selected=selected, but don't know wher to put the statement: My array is: state_province = array ("list of states", "provinces") Var in my labels array is "state"=>"state" Here is my code for the select/option statement: { if($field == "state") { echo "<div class='province_state'><label for='state' size='10'>* Province/State</label><select>"; foreach($state_province as $state) { echo "\n<option value='$state_province' /> "; echo $state ; echo "</option>"; } echo "</select></div>\n"; } ?Is this the correct code to add and where would I add it? if(@$_POST['state'] == $value) { echo "selected='selected' "; } 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 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! I have a search function in php where the text characters are matched to characters in a tables field--- works perfectly.... I need to make the input box have a droplist of words from database, this is also easy for me to do. the problem here is there is no definitive value! the options list always outputs a blank in the url--- its supposed to search a matching value and then output the matching value to url... Here is the droplist code: $output['RATESTITLE']='<input class="inputbox" type="text" size="24px" name="ratestitle" value="'.$sch->filter['ratestitle'].'" onfocus="if (this.value ==\''.$output['LANGUAGE_SEARCH_RATESTITLE'].'\') {this.value = \'\'}" />'; this outputs a input text box--- i want to have a droplist of options to populate this text box... If you must know this is the third day im at it... Given the following array $documentlist, displayed from print_r Array ( [MerchantDocumentInfo] => Array ( => Array ( [documentID] => 2760322451 [generatedDateTime] => 2010-08-03T16:02:45-07:00 ) [1] => Array ( [documentID] => 2761837402 [generatedDateTime] => 2010-08-03T23:01:15-07:00 ) ) ) I'm trying to figure out the syntax to use the documentID as a dynamic variable When I 'hard code' the variable, I get the document I want eg $order = $t->GetDocument('2760322451'); -- returns requested document info into $order array where $order is an array and $t are my connection credentials. I've made numerous attempts, but get errors in anything I try. Can someone tell me the correct syntax to use to pass a dynamic value for documentID from the $documentlist array at the top? I've tried $order = $t->GetDocument($documentlist['MerchantDocumentInfo' ]['documentID']) ; and get ===> syntax error, unexpected '[', expecting ']' $order = $t->GetDocument($documentlist->MerchantDocumentInfo[0]['documentID']) ; get nothing $order = $t->GetDocument($documentlist->MerchantDocumentInfo[1]['documentID']) ; get nothing $order = $t->GetDocument($documentlist->MerchantDocumentInfo[1][documentID]) ; get nothing Thanks in advance for any ideas, I've been trying to figure this out for days. I have some function or method. Is there a better design patter to implement this?
function myFunction($a=null,$b=null,$c=null,$d=null,$e=null,$f=null,$g=null,$h=null) { //Do a bunch of stuff }Maybe the second function? function myNewFunction($data=array()) { $data=array_merge(array('a'=>null,'b'=>null,'c'=>null,'d'=>null,'e'=>null,'f'=>null,'g'=>null,'h'=>null),$array); //Do a bunch of stuff }Please provide decision making factors why you would use one approach over the other. Hello.
I am new here.
I have a sligh problem, i saw a few results here which however did not lead to the desired result.
The problem is , i have this Json Response from a API:
Array ( [0] => Array ( [isoid] => 0 [omschrijving] => - leeg - ) [1] => Array ( [isoid] => 64 [omschrijving] => ArchLinux 2013.5 ) [2] => Array ( [isoid] => 75 [omschrijving] => AsteriskNOW 3.0.0 64b ) [3] => Array ( [isoid] => 67 [omschrijving] => CentOS 5.9 32b ) [4] => Array ( [isoid] => 2 [omschrijving] => CentOS 6.3 64b ) [5] => Array ( [isoid] => 96 [omschrijving] => CentOS 7.0 64b ) [6] => Array ( [isoid] => 4 [omschrijving] => Clear OS 5.2 64b ) [7] => Array ( [isoid] => 93 [omschrijving] => CloudLinux 6.4 ) [8] => Array ( [isoid] => 1 [omschrijving] => Debian GNU/Linux 6.0 / Squeeze 64b ) [9] => Array ( [isoid] => 79 [omschrijving] => Debian GNU/Linux 7.0 / Wheezy 32b ) [10] => Array ( [isoid] => 71 [omschrijving] => Debian GNU/Linux 7.0 / Wheezy 64b ) [11] => Array ( [isoid] => 63 [omschrijving] => Fedora 18 64b ) [12] => Array ( [isoid] => 82 [omschrijving] => FreeBSD 10 64b ) [13] => Array ( [isoid] => 77 [omschrijving] => FreeBSD 9.2 64b ) [14] => Array ( [isoid] => 10 [omschrijving] => FreePBX 5.211.65-12 ) [15] => Array ( [isoid] => 76 [omschrijving] => GParted Live CD ) [16] => Array ( [isoid] => 3 [omschrijving] => KVM Virtio drivers voor Windows ) [17] => Array ( [isoid] => 66 [omschrijving] => MailCleaner 2012v6 64b ) [18] => Array ( [isoid] => 68 [omschrijving] => Manjaro KDE 0.8.6 64b ) [19] => Array ( [isoid] => 78 [omschrijving] => Microsoft Windows 7 Pro 64b ) [20] => Array ( [isoid] => 69 [omschrijving] => Microsoft Windows Server 2003 EN ) [21] => Array ( [isoid] => 8 [omschrijving] => Microsoft Windows Server 2008R2 EN ) [22] => Array ( [isoid] => 7 [omschrijving] => Microsoft Windows Server 2008R2 NL ) [23] => Array ( [isoid] => 70 [omschrijving] => Microsoft Windows Server 2012 NL 64b ) [24] => Array ( [isoid] => 84 [omschrijving] => Microsoft Windows Server 2012R2 NL ) [25] => Array ( [isoid] => 83 [omschrijving] => NOC PS 1.0r11 ) [26] => Array ( [isoid] => 11 [omschrijving] => OpenBSD 5.2 ) [27] => Array ( [isoid] => 80 [omschrijving] => OpenBSD 5.4 ) [28] => Array ( [isoid] => 94 [omschrijving] => OpenBSD 5.5 64b ) [29] => Array ( [isoid] => 72 [omschrijving] => OpenSUSE 12.3 64b ) [30] => Array ( [isoid] => 95 [omschrijving] => Slackware 13.37 ) [31] => Array ( [isoid] => 12 [omschrijving] => System Rescue CD ) [32] => Array ( [isoid] => 18 [omschrijving] => Turnkey Appflower ) [33] => Array ( [isoid] => 19 [omschrijving] => Turnkey ASP.net/Apache ) [34] => Array ( [isoid] => 20 [omschrijving] => Turnkey Bugzilla ) [35] => Array ( [isoid] => 21 [omschrijving] => Turnkey CodeIgniter ) [36] => Array ( [isoid] => 22 [omschrijving] => Turnkey Django ) [37] => Array ( [isoid] => 23 [omschrijving] => Turnkey Dokuwiki ) [38] => Array ( [isoid] => 24 [omschrijving] => Turnkey DomainControler ) [39] => Array ( [isoid] => 25 [omschrijving] => Turnkey Drupal7 ) [40] => Array ( [isoid] => 26 [omschrijving] => Turnkey Fileserver ) [41] => Array ( [isoid] => 27 [omschrijving] => Turnkey Gallery ) [42] => Array ( [isoid] => 28 [omschrijving] => Turnkey Gitlab ) [43] => Array ( [isoid] => 15 [omschrijving] => Turnkey Google AppEngine Go ) [44] => Array ( [isoid] => 16 [omschrijving] => Turnkey Google AppEngine Java ) [45] => Array ( [isoid] => 17 [omschrijving] => Turnkey Google AppEngine Python ) [46] => Array ( [isoid] => 29 [omschrijving] => Turnkey IceScrum ) [47] => Array ( [isoid] => 30 [omschrijving] => Turnkey Joomla2.5 ) [48] => Array ( [isoid] => 31 [omschrijving] => Turnkey LAMP ) [49] => Array ( [isoid] => 32 [omschrijving] => Turnkey Lighttpd/PHP/FastCGI ) [50] => Array ( [isoid] => 33 [omschrijving] => Turnkey Magento ) [51] => Array ( [isoid] => 34 [omschrijving] => Turnkey Mediawiki ) [52] => Array ( [isoid] => 35 [omschrijving] => Turnkey MongoDB ) [53] => Array ( [isoid] => 36 [omschrijving] => Turnkey MySQL ) [54] => Array ( [isoid] => 37 [omschrijving] => Turnkey NGINX/PHP/FastCGI ) [55] => Array ( [isoid] => 38 [omschrijving] => Turnkey OpenLDAP ) [56] => Array ( [isoid] => 39 [omschrijving] => Turnkey OpenPhoto ) [57] => Array ( [isoid] => 40 [omschrijving] => Turnkey OSCommerce ) [58] => Array ( [isoid] => 41 [omschrijving] => Turnkey OTRS ) [59] => Array ( [isoid] => 42 [omschrijving] => Turnkey Owncloud ) [60] => Array ( [isoid] => 43 [omschrijving] => Turnkey PHPBB ) [61] => Array ( [isoid] => 44 [omschrijving] => Turnkey PHPList ) [62] => Array ( [isoid] => 45 [omschrijving] => Turnkey PHPNuke ) [63] => Array ( [isoid] => 46 [omschrijving] => Turnkey Postgresql ) [64] => Array ( [isoid] => 47 [omschrijving] => Turnkey Prestashop ) [65] => Array ( [isoid] => 48 [omschrijving] => Turnkey Rails ) [66] => Array ( [isoid] => 49 [omschrijving] => Turnkey Redmine ) [67] => Array ( [isoid] => 50 [omschrijving] => Turnkey SiTracker ) [68] => Array ( [isoid] => 51 [omschrijving] => Turnkey StatusNET ) [69] => Array ( [isoid] => 52 [omschrijving] => Turnkey SugarCRM ) [70] => Array ( [isoid] => 53 [omschrijving] => Turnkey Symfony ) [71] => Array ( [isoid] => 54 [omschrijving] => Turnkey Tomcat ) [72] => Array ( [isoid] => 55 [omschrijving] => Turnkey Tomcat/Apache ) [73] => Array ( [isoid] => 56 [omschrijving] => Turnkey TRAC ) [74] => Array ( [isoid] => 57 [omschrijving] => Turnkey TWiki ) [75] => Array ( [isoid] => 58 [omschrijving] => Turnkey Typo3 ) [76] => Array ( [isoid] => 59 [omschrijving] => Turnkey Wordpress ) [77] => Array ( [isoid] => 60 [omschrijving] => Turnkey Zencart ) [78] => Array ( [isoid] => 13 [omschrijving] => Ubuntu 10.04 32b ) [79] => Array ( [isoid] => 6 [omschrijving] => Ubuntu 10.04 64b ) [80] => Array ( [isoid] => 14 [omschrijving] => Ubuntu 12.04 32b ) [81] => Array ( [isoid] => 61 [omschrijving] => Ubuntu 12.04 64b ) [82] => Array ( [isoid] => 62 [omschrijving] => Ubuntu 12.10 64b ) [83] => Array ( [isoid] => 89 [omschrijving] => Ubuntu 14.04 LTS 64b ) [84] => Array ( [isoid] => 5 [omschrijving] => Windows Password Reset ) [85] => Array ( [isoid] => 81 [omschrijving] => Zen Loadbalancer 3.03 ) [86] => Array ( [isoid] => 74 [omschrijving] => Zentyal 3.2 ) )how would i go to fill it automatically in a option value like <option value='74'>Zentyal 3.2</option>Thank you in advance $seat_s is a $var that can have multiple values depending on a form in a previous page. this code works fine as is, but i need to pass the array into a 3rd page. i have no idea how to do this from the code below. ive tried passing the array straight into a _post then _get on the next page but that only holds the 1st value and not all of them. suggestions please.... thanks <?php $seat_s = $_POST['seats']; foreach($_POST['seats'] AS $seat) { $rowId = substr($seat, 0, 1); $columnId = substr($seat, 1); echo $rowId . $columnId . ", "; } ?> Hi all, new to php and struggling passing an array via url. first page: Code: [Select] $str = serialize($cartinfo); $strenc = urlencode($str); <A href="/test/getcart.php?cartinfo=<?PHP echo $strenc; ?>">test</A> Which does add a long string to the URL so I guess to here it's fine. Second Page: Code: [Select] <?PHP $cartinfo = unserialize($_GET["cartinfo"]); var_dump($cartinfo); ?> However all I get is: bool(false) Any advice would be great, I also tried adding $cartinfo to the session, but this didn't work either. Surely passing variables should be straight forward??? Thanks. I recently posted a simple query about ISSET and finally got that simple problem solved thanks to you guys. But I've hit a new snag. I've create a simple sort of cart, or record counter. While I can add/remove/clear items and display their affilated arrays, I don't know how to cycle through a multidimensional array that is dynamically set.
Something like $_SESSION['Primary'][$items][$attributes] - Where $items is a dynamic set, and $attributes is a fixed set of keys with values.
I can target individual $Items, or display all the items in there. But I can't display all the Items and their subsequent $attributes aswell. Do I have to write 1 set of Ajax code for just displaying the $items, and another for each individual set of $attributes? Or is their a way to cycle through each $item, and then all of it's(or specific) $attributes and values? I've tried using loops which logically work, but I can't pass it through json_encode.
Is there any documentation I could read in relation to this? I feel this is the key component to manuvering through a database of sorts. I'm just not entirely sure how to go about accessing multidimensional Array's without a ton of code that becomes redudent. And even then, it wouldnt work well with a dynamic setup.
Edited by 7blake, 07 November 2014 - 01:39 PM. Hello Everyone! I have created a javascript array which now i want to pass to php, so php can store those values to mysql. So please anyone can suggest me how do i pass it to php? Any help will highly be appreciated! I have the registration form blues! form 1 collects the classes chosen, and passes an array of classes chosen(on a previous page), in a hidden field: <input type="hidden" value="<?= $c_row['workshop_id'] ?>" name="wid[]" /> form 2 makes it a variable $wid = $_POST['wid']; I'm trying to pass it to form 3, using the hidden input again, this time as a variable: $wid = $_POST['wid']; <input type="hidden" value="<?= $wid ?>" name="wid[]" /> The next page is a printable page. But I can't do anything with the classes, because it's some how made an array of an array??? I wrote: $wid = $_POST['wid']; print_r($wid); This produces--- Array ( => Array ) I want it to give me the original array? Is there a different way to do this? |