PHP - Select Option Passing Variables
What 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>"; Similar TutorialsI 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>'; ?> I am adding to a shopping cart using sessions, when I add a product with a selected size it echoes the correct size as text but when applying it to my option boxes as selected, it just shows the last item in the select box. here is the code for the session variables <?php for ($basket_counter=0;$basket_counter<$_SESSION['ses_basket_items'];$basket_counter++) { $price=sprintf("%01.2f",$ses_basket_price[$basket_counter]); $quantity=$ses_basket_amount[$basket_counter]; $code=$ses_basket_stockcode[$basket_counter]; $itemID=$ses_basket_id[$basket_counter]; $name=$ses_basket_name[$basket_counter]; $image=$ses_basket_image[$basket_counter]; $size=$ses_basket_size[$basket_counter]; $sizechoice=$ses_basket_sizechoice[$basket_counter]; // create array from sizes and make the option box selections if ($sizechoice!="" && (!in_array($sizechoice, array('One Size', 'one size', 'free size', 'Free Size', 'Adjustable', 'adjustable')))) { // add size trigger $sizelist="add"; //create the array $sizepick=explode(",", $sizechoice); } else { $sizepick=$sizechoice; } // adjust gst for AU customers if ($country='AU') { $price=sprintf("%01.2f",($price*1.1)); $unit=sprintf("%01.2f",($price/$quantity)); } else { $unit=sprintf("%01.2f",($price/$quantity)); } ?> and this bit inside the same loop displayes the select box for size <?php if ($sizelist && $sizelist='add') { echo "<select name='size' id='size' style='vertical-align:middle;'>"; foreach($sizepick AS $sizes) { if ($sizes==$size) { echo "<option value='$size' selected='selected'>$size</option>"; } else { echo "<option value='$sizes'>$sizes</option>"; }} echo "</select>"; } else { echo $size; } ?> appreciate any help on this ok so below is the select option for my form i creatig should this select have the name 0f bday form of the three selects so that when i put it into a variable it could just be $birthday = $_POST = ['bday']; Code: [Select] <select class="drop" name="bday"> <option>Month</option> <option value="1">January</option> <option value="2">February</option> <option value="3">March</option> <option value="4">April</option> <option value="5">May</option> <option value="6">June</option> <option value="7">July</option> <option value="8">August</option> <option value="9">September</option> <option value="10">October</option> <option value="11">November</option> <option value="12">December</option> </select> <select class="drop" name="bday"> <option>Day</option> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> <option value="7">7</option> <option value="8">8</option> <option value="9">9</option> <option value="10">10</option> <option value="11">11</option> <option value="12">12</option> <option value="13">13</option> <option value="14">14</option> <option value="15">15</option> <option value="16">16</option> <option value="17">17</option> <option value="18">18</option> <option value="19">19</option> <option value="20">20</option> <option value="21">21</option> <option value="22">22</option> <option value="23">23</option> <option value="24">24</option> <option value="25">25</option> <option value="26">26</option> <option value="27">27</option> <option value="28">28</option> <option value="29">29</option> <option value="30">30</option> <option value="31">31</option> </select> <select class="drop" name="bday"> <option>Year</option> <option value="2011">2011</option> <option value="2010">2010</option> <option value="2009">2009</option> <option value="2008">2008</option> <option value="2007">2007</option> <option value="2006">2006</option> <option value="2005">2005</option> <option value="2004">2004</option> <option value="2003">2003</option> <option value="2002">2002</option> <option value="2001">2001</option> <option value="2000">2000</option> <option value="1999">1999</option> <option value="1998">1998</option> <option value="1997">1997</option> <option value="1996">1996</option> <option value="1995">1995</option> <option value="1994">1994</option> <option value="1993">1993</option> <option value="1992">1992</option> <option value="1991">1991</option> <option value="1990">1990</option> <option value="1989">1989</option> <option value="1988">1988</option> <option value="1987">1987</option> <option value="1986">1986</option> <option value="1985">1985</option> <option value="1984">1984</option> <option value="1983">1983</option> <option value="1982">1982</option> <option value="1981">1981</option> <option value="1980">1980</option> <option value="1979">1979</option> <option value="1978">1978</option> <option value="1977">1977</option> <option value="1976">1976</option> <option value="1975">1975</option> <option value="1974">1974</option> <option value="1973">1973</option> <option value="1972">1972</option> <option value="1971">1971</option> <option value="1970">1970</option> <option value="1969">1969</option> <option value="1968">1968</option> <option value="1967">1967</option> <option value="1966">1966</option> <option value="1965">1965</option> <option value="1964">1964</option> <option value="1963">1963</option> <option value="1962">1962</option> <option value="1961">1961</option> <option value="1960">1960</option> <option value="1959">1959</option> <option value="1958">1958</option> <option value="1957">1957</option> <option value="1956">1956</option> <option value="1955">1955</option> <option value="1954">1954</option> <option value="1953">1953</option> <option value="1952">1952</option> <option value="1951">1951</option> <option value="1950">1950</option> <option value="1949">1949</option> <option value="1948">1948</option> <option value="1947">1947</option> <option value="1946">1946</option> <option value="1945">1945</option> <option value="1944">1944</option> <option value="1943">1943</option> <option value="1942">1942</option> <option value="1941">1941</option> <option value="1940">1940</option> <option value="1939">1939</option> <option value="1938">1938</option> <option value="1937">1937</option> <option value="1936">1936</option> <option value="1935">1935</option> <option value="1934">1934</option> <option value="1933">1933</option> <option value="1932">1932</option> <option value="1931">1931</option> <option value="1930">1930</option> <option value="1929">1929</option> <option value="1928">1928</option> <option value="1927">1927</option> <option value="1926">1926</option> <option value="1925">1925</option> <option value="1924">1924</option> <option value="1923">1923</option> <option value="1922">1922</option> <option value="1921">1921</option> <option value="1920">1920</option> <option value="1919">1919</option> <option value="1918">1918</option> <option value="1917">1917</option> <option value="1916">1916</option> <option value="1915">1915</option> <option value="1914">1914</option> <option value="1913">1913</option> <option value="1912">1912</option> <option value="1911">1911</option> <option value="1910">1910</option> <option value="1909">1909</option> <option value="1908">1908</option> <option value="1907">1907</option> <option value="1906">1906</option> <option value="1905">1905</option> <option value="1904">1904</option> <option value="1903">1903</option> <option value="1902">1902</option> <option value="1901">1901</option> <option value="1900">1900</option> </select> Hi.. I need to add code to check if the compound that was choose is reach the maximum value then if it is already reach theirs a notification displayed that he already gain the maximum. the problem is..I don't know how can I check if what the user choose before run the condition. here is my code: Code: [Select] <?php $config['BASE_DIR'] = dirname(dirname(__FILE__)); $config['BASE_DIR'] = $config['BASE_DIR']. '\MES PROJECT'; define('SMARTY_DIR', $config['BASE_DIR']. '/INCLUDE/smarty/libs/'); require(SMARTY_DIR . 'Smarty.class.php'); $smarty = new Smarty(); $smarty = new Smarty(); $smarty->template_dir = $config['BASE_DIR']. '/smarty/templates'; $smarty->config_dir = $config['BASE_DIR']. '/smarty/config'; $smarty->cache_dir = $config['BASE_DIR']. '/INCLUDE/smarty/cache'; $smarty->compile_dir = $config['BASE_DIR']. '/INCLUDE/smarty/templates_c'; // ================================================================================================================= $con= mysql_connect('localhost', 'root', ''); if (!$con) { echo 'failed'; die(); } mysql_select_db("mes", $con); $hostAddr = $_SERVER['REMOTE_ADDR']; $terminal = $hostAddr; //<-enable this in server //$terminal = $_POST['doThis']; //<- disable this in server $terminal = "192.168.1.101"; switch ($terminal) { case "192.168.1.101" : //<< enable this in server //case "1" : $smarty->assign('process', 'Rubber/Chemical Preparation'); $smarty->assign('termNo', 'Terminal 1'); $smarty->assign('text_name1','Compound Code'); $smarty->assign('text_name2','Lot Traveler ID'); $smarty->assign('text_name3','Kit Weight '); $smarty->assign('text_name4','Operator Code'); [b] $smarty->assign('compoundIndexValue', array('0', 'P28', 'P30', 'P32', 'P33', 'P35', 'P35M', 'P38', 'P40', 'P41', 'P42', 'P43', 'P46', 'P47', 'PXX', 'P35W'));[/b] $smarty->assign('names', array('<Choose Code>', 'P28', 'P30', 'P32', 'P33', 'P35', 'P35M', 'P38', 'P40', 'P41', 'P42', 'P43', 'P46', 'P47', 'PXX', 'P35W')); $smarty->assign('weightIndexValue', array('0', '60.145', '68.980', '65.381', '69.270', '49.360', '68.610', '54.880', '73.300', '51.973', '52.944', '57.627', '45.997', '69.196', '70.000', '55.000')); $smarty->assign('kitWeight', array('<Choose Weight>','60.145', '68.980', '65.381', '69.270', '49.360', '68.610', '54.880', '73.300', '51.973', '52.944', '57.627', '45.997', '69.196', '70.000', '55.000')); //Chemical weighing Process : Terminal 1 $smarty->display('header.tpl'); // common Header $smarty->display('box_1.tpl'); $smarty->display('footer.tpl'); [b] $compound = mysql_real_escape_string($_POST['compoundIndexValue']); $sql = "SELECT P28, P28_max, P28_min, P30, P30_max, P30_min, P32, P32_max, P32_min, P33, P33_max, P33_min, P35, P35_max, P35_min, P35M, P35M_max, P35M_min, P35W, P35W_max, P35W_min, P38, P38_max, P38_min, P41, P41_max, P41_min, P42, P42_max, P42_min, P43, P43_max, P43_min, P46, P46_max, P46_min, P47, P47_max, P47_min FROM parameter_settings"; $res_pcode = mysql_query($sql, $con); $row = mysql_fetch_assoc($res_pcode); $P28 = $row['P28']; $P28_max = $row['P28_max']; $P28_min = $row['P28_min']; $P30 = $row['P30']; $P30_max = $row['P30_max']; $P30_min = $row['P30_min']; $P32 = $row['P32']; $P32_max = $row['P32_max']; $P32_min = $row['P32_min']; $P33 = $row['P33']; $P33_max = $row['P33_max']; $P33_min = $row['P33_min']; $P35 = $row['P35']; $P35_max = $row['P35_max']; $P35_min = $row['P35_min']; $P35M = $row['P35M']; $P35M_max = $row['P35M_max']; $P35M_min = $row['P35M_min']; $P35W = $row['P35W']; $P35W_max = $row['P35W_max']; $P35W_min = $row['P35W_min']; $P38 = $row['P38']; $P38_max = $row['P38_max']; $P38_min = $row['P38_min']; $P41 = $row['P41']; $P41_max = $row['P41_max']; $P41_min = $row['P41_min']; $P42 = $row['P42']; $P42_max = $row['P42_max']; $P42_min = $row['P42_min']; $P43 = $row['P43']; $P43_max = $row['P43_max']; $P43_min = $row['P43_min']; $P46 = $row['P46']; $P46_max = $row['P46_max']; $P46_min = $row['P46_min']; $P47 = $row['P47']; $P47_max = $row['P47_max']; $P47_min = $row['P47_min']; $sql = "SELECT PCODE, total FROM kanban_checker WHERE PCODE = '$compound' ORDER BY PCODE"; $res_kanban = mysql_query($sql, $con); $row_kanban = mysql_fetch_assoc($res_kanban); $PCODE = $row_kanban['PCODE']; $total = $row_kanban['total']; if($compound == $P28 && $total == $P28_max){ echo "<script type='text/javascript'>notify(P28 gain total maximum)</script>"; } else { echo ''; } if($compound == $P30 && $total == $P30_max){ echo "<script type='text/javascript'>notify(P30 gain total maximum)</script>"; } else{ echo ''; } if($compound == $P32 && $total == $P32_max){ echo "<script type='text/javascript'>notify(P32 gain total maximum)</script>"; } else{ echo ''; } if($compound == $P33 && $total == $P33_max){ echo "<script type='text/javascript'>notify(P33 gain total maximum)</script>"; } else{ echo ''; } if($compound == $P35 && $total == $P35_max){ echo "<script type='text/javascript'>notify(P35 gain total maximum)</script>"; } else{ echo ''; } if($compound == $P35M && $total == $P35M_max){ echo "<script type='text/javascript'>notify(P35M gain total maximum)</script>"; } else{ echo ''; } if($compound == $P35W && $total == $P35W_max){ echo "<script type='text/javascript'>notify(P35W gain total maximum)</script>"; } else{ echo ''; } if($compound == $P38 && $total == $P38_max){ echo "<script type='text/javascript'>notify(P38 gain total maximum)</script>"; } else{ echo ''; } if($compound == $P41 && $total == $P41_max){ echo "<script type='text/javascript'>notify(P41 gain total maximum)</script>"; } else{ echo ''; } if($compound == $P42 && $total == $P42_max){ echo "<script type='text/javascript'>notify(P42 gain total maximum)</script>"; } else{ echo ''; } if($compound == $P43 && $total == $P43_max){ echo "<script type='text/javascript'>notify(P43 gain total maximum)</script>"; } else{ echo ''; } if($compound == $P46 && $total == $P46_max){ echo "<script type='text/javascript'>notify(P46 gain total maximum)</script>"; } else{ echo ''; } if($compound == $P47 && $total == $P47_max){ echo "<script type='text/javascript'>notify(P47 gain total maximum)</script>"; } else{ echo ''; }[/b] break; case "192.168.1.102" : //<< enable this in server //case "2" : $smarty->assign('process', 'Compounding Process'); $smarty->assign('termNo', 'Terminal 2'); $smarty->assign('text_name1','Lot Traveler ID'); $smarty->assign('text_name2','Kit Weight'); $smarty->assign('text_name3','Machine Code'); $smarty->assign('text_name4','Operator Code'); $smarty->assign('machineID', array('0', 'B1', 'B2', 'B3', 'K1', 'K2', 'OM1', 'OM2', 'OM3', 'OM4', 'OM5', 'OM6', 'OM7')); $smarty->assign('machineIDdisplay', array('<Choose Machine ID>', 'B1', 'B2', 'B3', 'K1', 'K2', 'OM1', 'OM2', 'OM3', 'OM4', 'OM5', 'OM6', 'OM7')); $smarty->display('header.tpl'); // common Header $smarty->display('box_2.tpl'); $smarty->display('footer.tpl'); break; case "192.168.1.103" : //<< enable this in server //case "3" : $smarty->assign('process', 'Extrusion Process'); $smarty->assign('termNo', 'Terminal 3'); $smarty->assign('text_name1','Lot Traveler ID'); $smarty->assign('text_name2','Kit Weight'); $smarty->assign('text_name3','Machine Code'); $smarty->assign('text_name4','Operator Code'); $smarty->assign('machineID', array('0', 'E1', 'E2', 'E3', 'E4', 'E5', 'E6')); $smarty->assign('machineIDdisplay', array('<Choose Machine ID>', 'E1', 'E2', 'E3', 'E4', 'E5', 'E6')); $smarty->display('header.tpl'); // common Header $smarty->display('box_2.tpl'); $smarty->display('footer.tpl'); break; case "192.168.1.104" : //<< enable this in server //case "4" : $smarty->assign('process', 'Half Shell Forming'); $smarty->assign('termNo', 'Terminal 4'); $smarty->assign('text_name1','Lot Traveler ID'); $smarty->assign('text_nameDG','New Lot ID'); $smarty->assign('text_name2','Machine ID'); $smarty->assign('text_name3','Output Qty.'); $smarty->assign('text_name4','Reject Qty.'); $smarty->assign('text_name5','Operator Code'); $smarty->assign('id', array('0', 'NTG1', 'NTG2', 'NTG3', 'NTG4', 'GTG1', 'SQG1', 'PL1')); $smarty->assign('id_name', array('<Choose Machine ID>', 'NTG1', 'NTG2', 'NTG3', 'NTG4', 'GTG1', 'SQG1', 'PL1')); $smarty->display('header.tpl'); // common Header $smarty->display('box_3.tpl'); $smarty->display('footer.tpl'); break; case "192.168.1.105" : //<< enable this in server //case "5" : $smarty->assign('process', 'Half Shell Deflashing'); //= to be implemented $smarty->assign('termNo', 'Terminal 5'); $smarty->assign('text_name1','Lot Traveler ID'); $smarty->assign('text_name2','Machine ID'); $smarty->assign('text_name3','Output Qty.'); $smarty->assign('text_name4','Reject Qty.'); $smarty->assign('text_name5','Operator Code'); $smarty->assign('id', array('0', 'US DEF.1', 'US DEF.2', 'FRENCH DEF.1', 'FRENCH DEF.2', 'THAILAND DEF.1', 'THAILAND DEF.2', 'HANAU 45 DEF.')); $smarty->assign('id_name', array('<Choose Machine ID>', 'US DEF.1', 'US DEF.2', 'FRENCH DEF.1', 'FRENCH DEF.2', 'THAILAND DEF.1', 'THAILAND DEF.2', 'HANAU 45 DEF.')); $smarty->display('header.tpl'); // common Header $smarty->display('box_3.tpl'); $smarty->display('footer.tpl'); break; } ?> My only purpose is to avoid adding data so i need to prompt if he already reach the maximum per compound. Thank you so much i have this select box in a form Code: [Select] <select name='theoptions' style='color: #000000;text-align:center;background-color:#DEDEDE;border: 1px solid #D99C29;width:163px;padding:5px;' onchange='optionChanged(this);ChgBox(this.value);'> <option value='1' >Your comment on</option> <option value='3' >Your question on</option> <option value='4' >Your expertise on</option> <option value='2' >Your image about</option> <option value='5' >Your website about</option> <option value='0' >Comparison</option> </select> on the page where the form directs to i have Code: [Select] $options = $_POST['theoptions']; I want to get option 5 specificially, how do i do that? I'm trying to pass php select option value to another page through url.but it's not working.please help me.
member.php
<?php mysql_connect("localhost","root","") or die(mysql_error()); mysql_select_db("nordfxlk_member")or die(mysql_error()); $result = mysql_query("SELECT id,ugroup FROM ugroups"); ?> <select name='group' id='group' > <?php while ($line = mysql_fetch_array($result)) { echo '<option value=' . $line['ugroup'] . '>' . $line['ugroup'] . '</option>'; }?> </select> <a href="db_sql/add_group.php?ugroup=<?php echo $line['ugroup'] ;?>"> click</a>add_group.php include('../limoconfig.php'); if(!isset($_SESSION['adminuserid']) ) { header('Location:../index.php'); } else { $ugroup = $_GET['ugroup']; /*$id = $_GET['id'];*/ $acc_status = "update users set ugroup='".$ugroup."' where id=1931"; echo $acc_status; $rate = db::getInstance()->exec($acc_status); header('Location:../test.php'); } } Hello, guys! Just a small first ever thread, where I ask a question where I hope anyone is able to help me out I am working on a project with a friend of mine for a company. I have a problem with the function on a form. I wonder; How do i change the option value of a form? Let's say if I choose a category like "Cake", I want the second drop down box to display different brands of cake. But if I choose bicycle for example, I want the option values to be different brands of bicycles. I hope you guys understand what I was trying to say here. Anyways, here is a sample image where I want this function to occur: Sample: Cheers and thanks in advance, Marius OK so I'm having a pull my hair out moment. I have spent all day trying to figure this out. I have a select box for a list of customers where one customer is unique and I want that account to appear twice in the list. That part was easy and when selected the appropriate info populates the page. The problem I am having is that no matter which one of those two options I click it only selects the second option . So in other words if these are the two options in the list: Some Business Week 1 Some Business Week 2 when I click either, Some Business Week 2 is always the one selected even though the page populates correctly. Any thoughts on what I need to change? Code: [Select] <?php do { mysql_select_db($database_customers, $customers); $query_multiple = "SELECT accnt, week, alt FROM schedule WHERE accnt = " . $customer['accnt']; $multiple_sel = mysql_query($query_multiple, $customers) or die(mysql_error()); $multiple = mysql_fetch_assoc($multiple_sel); $multiple_run = $multiple['alt']; if($multiple_run > 1) { for ($i = 1; $i <= $multiple_run; $i++) { mysql_select_db($database_customers, $customers); $query_get_week = "SELECT week, alt FROM schedule WHERE accnt = " . $customer['accnt'] . " AND alt = " . $i; $get_week_sel = mysql_query($query_get_week, $customers) or die(mysql_error()); $get_week = mysql_fetch_assoc($get_week_sel); $version1 = $inv_title . " Week " . $get_week['week']; $version2 = $customer['name'] . " Week " . $get_week['week']; ?> <option value="report.php?accnt=<?php echo $customer['accnt']; ?>&alt=<?php echo $get_week['alt'];?>"<?php if (!(strcmp($version1, $version2))) {echo "selected=\"selected\"";} ?>><?php echo $version2; ?></option> <?php } } else { $version1 = $inv_title; $version2 = $customer['name']; ?> <option value="report.php?accnt=<?php echo $customer['accnt']; ?>&alt=<?php echo $multiple['alt'];?>"<?php if (!(strcmp($version1, $version2))) {echo "selected=\"selected\"";} ?>><?php echo $version2; ?></option> <?php } ?> <?php } while ($customer = mysql_fetch_assoc($customer_sel)); ?> I've been using an option that's a state, an example would be South Carolina or North Dekota. In the url the $_GET var turns it into South+Carolina or North+Dekota. Is this common and okay across different Browsers? I've tried ie and firefox and the + sign is addded but I was wondering if they're just designed to be as idiot proof as possible. Thanks HI All,
I am creating a dropdown box on an edit user form. The box is populated from a table ssm_role and relates to the user which is another table. I am wanting the value of the dropdown to be set as whatever the loaded user has in their database table. See the images below. $sql = "SELECT * FROM ssm_role ORDER BY role_name ASC"; if($result = mysqli_query($conn, $sql)){ if (mysqli_num_rows($result)>0){ while ($row = mysqli_fetch_array($result)){ echo "<option value='".$row['role_id']."'>".$row['role_name']."</option>"; } } } This is what i am currently doing to make the dropdown but obviously this isnt even attempting to set the default. Your help is always appreciated
Hi.. I got problem in logic on my problem in select option. Here is my scenario. I have select option which has a compound list: example: P28 P30 P32 P33 P35 and I have tables which has a total count of compound that was already transact. for example I already transact 10 P28 compound. it will save in kanban_checker table field Total. and I have parameter_settings table which has the maximum and minimum per compound: fields----------data P28------------P28 P28_max-----10 P28_min------6 P30------------P28 P30_max-----10 P30_min------6 P32------------P28 P32_max-----10 P32_min------6 P33------------P28 P33_max-----10 P33_min------6 now the logic is: if P28 total = P28_max then notify that he already reach the maximum..it will not produce P28 because he already reach the maximum. if P28 total = P28_min then produce P28. same with other compound. Now, I got a problem in coding and logic, because in the select option I'm not the one who code it.. I just one who need to add the additional function.. here is the code for select option and the function that was created by other, Code: [Select] $smarty->assign('text_name1','Compound Code'); $smarty->assign('compoundIndexValue', array('0', 'P28', 'P30', 'P32', 'P33', 'P35', 'P35M', 'P38', 'P40', 'P41', 'P42', 'P43', 'P46', 'P47', 'PXX', 'P35W')); <tr> <td class="tdMainText">{$text_name1}</td> <td> <select class="tdMainElement" id="selCompound" onchange="isSelected('selCompound','txtLotCode')" onclick="clearNotify()" onblur="this.focus();" onkeypress="return false">{html_options values=$compoundIndexValue output=$names selected="0"} </select> </td> </tr> <script type="text/javascript"> function isSelected(obj1, obj2) { if (!document.getElementById(obj1).disabled) { document.getElementById(obj1).disabled = true; } if (document.getElementById('clear').disabled) { document.getElementById('clear').disabled = false; //enable it } if ((document.getElementById('chkDownGrade') != null)) { if (!document.getElementById('chkDownGrade').disabled) { document.getElementById('chkDownGrade').disabled = true; } } if (document.getElementById(obj2).disabled) { document.getElementById(obj2).disabled = false; } document.getElementById(obj2).focus(); document.getElementById(obj2).focus(); //notify("Gain Maximum Total"); } function disable() { if (!document.getElementById('clear').disabled) { document.getElementById('clear').disabled = true; } else { document.getElementById('clear').disabled = false; } } function clearNotify() { if (document.getElementById('notice') != null) { document.getElementsByTagName('body')[0].removeChild(document.getElementById('notice')) //>> clear the box } } </script> and here is the code that I tried to add: Code: [Select] $compound = mysql_real_escape_string($_POST['compound']); $sql = "SELECT P28, P28_max, P28_min, P30, P30_max, P30_min, P32, P32_max, P32_min, P33, P33_max, P33_min, P35, P35_max, P35_min, P35M, P35M_max, P35M_min, P35W, P35W_max, P35W_min, P38, P38_max, P38_min, P41, P41_max, P41_min, P42, P42_max, P42_min, P43, P43_max, P43_min, P46, P46_max, P46_min FROM parameter_settings"; $res_pcode = mysql_query($sql, $con); while($row = mysql_fetch_assoc($res_pcode)){ $P28 = $row['P28']; $P28_max = $row['P28_max']; $P28_min = $row['P28_min']; $P30 = $row['P30']; $P30_max = $row['P30_max']; $P30_min = $row['P30_min']; $P32 = $row['P32']; $P32_max = $row['P32_max']; $P32_min = $row['P32_min']; $P33 = $row['P33']; $P33_max = $row['P33_max']; $P33_min = $row['P33_min']; $P35 = $row['P35']; $P35_max = $row['P35_max']; $P35_min = $row['P35_min']; $P35M = $row['P35M']; $P35M_max = $row['P35M_max']; $P35M_min = $row['P35M_min']; $P35W = $row['P35W']; $P35W_max = $row['P35W_max']; $P35W_min = $row['P35W_min']; $P38 = $row['P38']; $P38_max = $row['P38_max']; $P38_min = $row['P38_min']; $P41 = $row['P41']; $P41_max = $row['P41_max']; $P41_min = $row['P41_min']; $P42 = $row['P42']; $P42_max = $row['P42_max']; $P42_min = $row['P42_min']; $P43 = $row['P43']; $P43_max = $row['P43_max']; $P43_min = $row['P43_min']; $P46 = $row['P46']; $P46_max = $row['P46_max']; $P46_min = $row['P46_min']; $P47 = $row['P47']; $P47_max = $row['P47_max']; $P47_min = $row['P47_min']; } // $sub_lotcode = substr($lotCode, 9, 4); $sql = "SELECT PCODE, total FROM kanba_checker WHERE PCODE = '$sub_lotcode' ORDER BY PCODE"; $res_kanban = mysql_query($sql, $con); $row_kanban = mysql_fetch_assoc($res_kanban); $PCODE = $row_kanban['PCODE']; $total = $row_kanban['total']; if($compound = $P28 || $total == $P28_max){ echo "<script type='text/javascript'>alert(P28 gain total maximum)</script>"; } else{ } but I don't know if my code and my logic is correct. I think I did to add function. But I don't know how.. I hope someone can help me or guide me to solve my problem. Thank you so much.. If I have a variable and a hard coded select dropdown, what is the easiest way to compare the variable with the value and set that particular option's selected attributed to selected? Hey guys there is probably a simple fix to this but i am just not seeing it ... Im createing a form that has error catching and self submitting valuse. I am trying to use a for loop to create all of the values and if the form is returned with an error then the correct values will still be filled out but i cant seem to get this loop to work. Every time i submit the form it doesnt matter what option i select it always comes back with the last one in the list or 30 in this case. the problem code is below.. Any help would be appreciated. Code: [Select] <?php for($i=1; $i<=30; $i++){ echo'<option value="'.$i.'"'; if(isset($_POST['petsAge'])== $i){ echo ' selected="selected"';} echo '>'.$i.'</option>'; } ?> Hello all, So I've picked up a PHP book in an attempt to learn it. The issue I'm having is preventing me from getting any further. They have me creating a simple order form, but the data is not passing from the HTML page to the PHP Processing file. I know there are other ways of doing this that I'm unaware of, but this code is verbatam to what we are isntructed to type within the book itself. Here is the code orderform.html: Code: [Select] <html> <body> <form action="processorder.php" method="post"> <table border="0"> <tr bgcolor="#cccccc"> <td width="150">Item</td> <td width="15">Quantity</td> </tr> <tr> <td>Tires</td> <td align="center"><input type="text" name="tireqty" size="3" maxlength="3"></td> </tr> <tr> <td>Oil</td> <td align="center"><input type="text" name="oilqty" size="3" maxlength="3"></td> </tr> <tr> <td>Spark Plugs</td> <td align="center"><input type="text" name="sparkqty" size="3" maxlength="3"></td> </tr> <tr> <td>How did you find Bob's?</td> <td><select name="find"> <option value = "a">I'm a regular customer</option> <option value = "b">TV advertising</option> <option value = "c">Phone directory</option> <option value = "d">Word of mouth</option> </select> </td> </tr> <tr> <td colspan="2" align="center"><input type="submit" value="Submit Order"></td> </tr> </table> </form> </body> </html> processorder.php: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Bobs Auto Parts - Order Results</title> </head> <body> <h1>Bobs Auto Parts</h1> <h2>Order Results</h2> <?php $tireqty = $_post['tireqty']; $oilqty = $_post['oilqty']; $sparkqty = $_post['sparkqty']; echo "<p>Order Processed at "; echo date('H:i, jS F Y'); echo "</p>"; echo '<p>Your order is as follows: </p>'; echo $tireqty.' tires<br />'; echo $oilqty.' bottles of oil<br />'; echo $sparkqty.' spark plugs<br />'; $totalqty = 0; $totalamount = 0.00; define('TIREPRICE', 100); define('OILPRICE', 10); define('SPARKPRICE', 4); ?> </body> </html> For some reason the values on the processing form dont show up. The only text thats displayed is : Bobs Auto Parts Order Results Order Processed at 17:07, 9th January 2011 Your order is as follows: tires <---- Should be showing the total quantity ordered bottles of oil <---- Should be showing the total quantity ordered spark plugs <---- Should be showing the total quantity ordered Is anyone able to let me know where the error is in this code? The writers website isnt any help.... Regards, sapper6fd I normally don't work with PHP or rather I'm learning as I go..and this is pretty much my last barrier between completing this project. Anyway here are my two files: http://pastebin.com/aThU3akC - file i want to grab values from and pass to the file below http://pastebin.com/kTYHr99p - file that is suppose to display the values in $transmessage Basically I need the variables defined in the first file to be passed and usable in the second and I'm not sure why I can't Hi, I'm trying to pass a variable into a URL and apparently I'm doing it wrong this code is OK Code: [Select] $id = $3; echo '<a href="newPage.php?id=3"></a> If I use Code: [Select] $id = $_GET['id']; echo $id; on the newPage.php, I echo 3 whereas, if I do Code: [Select] $id = $3; echo '<a href="newPage.php?id="'.$id.'"></a> when echo out on the newPage.php it prints out nothing also, in current url look like this: Code: [Select] www.site.com/newPage.php?id= What am I doing wrong? Many thanks I have the following code that outputs a url. It searches my MySQL database for the name of a given item within a theme: $relative = 'http://www.domain.com/wp-content/'; $url1= $relative . 'themes/arjuna-x/itemspec.php?type='; $url2='&item='; <a class="entry-thumbnails-link" href="<?php echo $url1.'Themes'.$url2.$rowThemes['Theme']; ?>"> The output is as follows: http://www.domain.com/wp-content/themes/arjuna-x/itemspec.php?type=Themes&item=(insert variable here) All is good up to this point. My problem however, is that some items (in this case: theme names) have apostrophes in them. For example: April Fool's. This results in breaking my php code. How can I get php to call these variables with apostrophes so that they don't break my php? Hi First post here. Long time reader! I'm looking to gauge the general practices of dealing with variables between pages. I'd always pass my variables through the POST. Im normally always doing a post back and processing the data at the top of the page. I never liked the query string as it open to manipulation, but can see its use for a search results page and saving the url. I came from a ASP background and we would only use session variables for holding user login information as the windows server had a habit of restarting the pool and loosing the session. We didn't want this happening, for example, when doing an e-commerce transaction. We always felt the post was the most robust method. Now Im using php and all the great features it has. I was looking to see what the more experience php developers used and am I right sticking to the post method, or is utilising session a more modern way of doing things. I've a few years experience doing web dev, just thought I touch base on a few issues to make sure I'm still heading in the right direction. Thanks for any advice guys! I'm creating this URL to pass variables to use from one Page to another:
http://eg10basketbal...Borgman&team=16
My WP site is seeing the first variable but not the second. After some searching I've found this suggestion, but it's not working for me:
function add_query_vars_filter( $vars ) { $vars[] = "nameFull"; $vars[] = "team"; return $vars; } add_filter( 'query_vars', 'add_query_vars_filter' );I tried putting this in the wp-includes/functions.php file of the, but ended up with a fatal error. I have since added it to my theme's functions.php file. There isn't an error, but it doesn't yield recognition of my second variable. hai everybody....
1. can any one let me know how to pass a variable from view to controller in CodeIgniter...
2. if possible send me a complete login application...developed by using CodeIgniter....
Thanks & Regards,
Shankaar.
|