
Kano
Members-
Posts
76 -
Joined
-
Last visited
Never
Everything posted by Kano
-
[SOLVED] using input id instead of name when calculating forms
Kano replied to Kano's topic in Javascript Help
hi there, How would one address <select> elements using DOM, for example: document.form[0].element - then I need to add select element[0] (but cannot use the name), how could i do this, many thanks. -
Hi there, I have this javascript code to calculate form elements: function calc() { document.calcform.total1.value = (document.calcform.price1.value)*(document.calcform.quantity1.value) etc...... } the .total1. is the 'name' of the input (text) tag but i would like to use the 'id' of the input tag because i am using the 'name' for something else. Could i just replace the .total1. with the 'id' and it will still work?
-
Thanks, thorpe. A dot at each end, I put one before the assignment operator but never considered after the variable, cool.
-
HI there, When adding strings together I have read that the code is: $msg = " blarb"; $msg .= "blarb"; // with a dot OK, so can someone help me in understanding how this can be achieved with a for loop. So far I have: for($cnt=0;$cnt<$max;$cnt++) { $invoice_msg = "$orderline[$cnt]\n\n"; } obviously, the loop keeps replacing the contents of the variable, can someone help me please, many thanks.
-
Hi there, I would like to update the mysql database using a $_SESSION array. The array looks like this when using print_r [VA001] => 8 [VA002] => 26 etc......... What i would like the SQL to do is update table column = value of $_SESSION array where column = key of $_SESSION array. Could someone show me how to write this and is there anythong that needs to be done to the array such as stripslashs or trim or anything like that. Thanks.
-
oops, I think session_start() may help.
-
HI there, PHP bends the mind. I can't seem to be able to get $_POST variables and use them in another script, for example, the user fills in an order form and processes it, the same script runs again and if that form $_GET['orderform'] == 'yes' then include a file that builds a comfirmation page, on this page I wish to have the user either confim or cancel/edit. How can I get the script to build the form again for edit? thanks.
-
HI there, Can someone help me please, I have a form with two buttons - cancel and submit, <form action = "order.php?process=yes" method = "post"> <input type = "submit" name="submit" value="cancel"> <input type = "submit" name="submit" value="submit"> How does one get the script to reset on cancel or process order on submit? thanks.
-
The select name is taken as a product id from the database, the option values are a count. The user selects product qty's on a list then processes the order, they are then asked to confirm or cancel/edit order, on cancel/edit order the user is taken back to the previous form in the remembered state to edit. I wish to have the select inputs to remember which value was selected between 0 and highest number. thanks.
-
Hi there, How does a script remember selected qty when the user needs to edit an order form. echo"<select name ='blar'>"; for($num;$num<$num2;$num++) { echo"<option value = '$num'"; ........................... // here needs to be selected = 'selected' at the correct place????? echo">$num</option>"; thanks. } echo"</select>";
-
[SOLVED] Getting to an array from a different script
Kano replied to Kano's topic in PHP Coding Help
Yes thanks monk.e.boy, I saw the prob whilst reading the post, thanks. I have created an sql query to select those records where qty is > 0 and = select name (which is product id). many thanks. -
[SOLVED] Getting to an array from a different script
Kano replied to Kano's topic in PHP Coding Help
Hi there, I understand what you mean , but I wish just to get to the arrays only not include the whole script. part of first script: $sqlqry_getwsi = "select * from tbl_wsi"; $sqlres_getwsi = mysql_query($sqlqry_getwsi) or die ("Could not execute getwsi query"); $num = 0; $wsi_tn_arr= ""; $wsi_id_arr= ""; $wsi_desc_arr= ""; $wsi_dim_arr= ""; $wsi_cm_arr= ""; $wsi_price_arr= ""; $wsi_qty_arr= ""; $wsi_nxtshiparr_arr= ""; $wsi_img_arr= ""; while($row_getwsi = mysql_fetch_array($sqlres_getwsi)) { extract($row_getwsi); $wsi_id_arr[$num] = $wsi_id; $wsi_desc_arr[$num] = $wsi_desc; $wsi_dim_arr[$num] = $wsi_dim; $wsi_cm_arr[$num] = $wsi_cm; $wsi_price_arr[$num] = $wsi_price; $wsi_qty_arr[$num] = $wsi_qty; $wsi_tn_arr[$num] = $wsi_tn; $wsi_img_arr[$num] = $wsi_img; $wsi_nxtshiparr_arr[$num] = $wsi_nxtshiparr; echo "<tr><td>$wsi_tn_arr[$num]</td><td>$wsi_id_arr[$num]</td><td>$wsi_desc_arr[$num]</td> <td>$wsi_dim_arr[$num]</td><td>$wsi_cm_arr[$num]</td><td>$wsi_price_arr[$num]</td> <td>$wsi_qty_arr[$num]</td><td>$wsi_nxtshiparr_arr[$num]</td> <td><select name='$wsi_id_arr[$num]'>"; for($selectcnt=0;$selectcnt<=$wsi_qty_arr[$num];$selectcnt++) { echo"<option value='$selectcnt'"; if(isset($remember_qty[$num])) { echo"selected='selected'"; } else if($selectcnt==0){ echo"selected='selected'"; } else{} echo">$selectcnt</option>"; } echo "</select></td><tr>"; -
Hi there, using select * sql I have created a list of products on a page, I print this list and store it into arrays as well, the prob I am having is accessing the arrays on another script (process order script): The arrays on the first script look like this: while { extract($variable); $array[$num] = $variable; } Can anyone help me? thanks.
-
Yes thanks man, The form is a list with select at end to select qty's, it is a simple form for our furniture wholesale customers so they can select everything they want on one form for a container, thanks.
-
Hi there, Yes it outputs an array ([VB001] => 6 etc...) How do I get to the key as a variable, because I would like to add all the quantities so that if they are greater than 0 then the user has made a purchase thanks.
-
Hi there, I have a query regarding <select> name: The script runs through a for loop for each select which gets the qty's from the DB, so the user can only select the maximum thats available in stock. Each select is given a name, which is the record ID from the DB ($wsi_id_arr[$num]). So the first select will be <select name="VB001"> for example. However, the problem i am having is how do I get at this in another script, for example, so far I have: for($ordercnt=0;$ordercnt<$num;$ordercnt++) { if(................... thanks.
-
oops my mistake you created variables previously
-
HI there, should you select statements where ....... = ('$_post[]'); ??
-
Problem solved: I change the file encoding from utf-8 to ansi and that worked, thanks for the help.
-
Having a mare with the header function: my script reads on the first line before any output: <?php if($_SESSION['auth'] = "yes" { header ("Location: http://blar blar.php"); } ?> There is no space before the <?php and IE is giving me a warning that = cannot add header information - headers already sent by... Can anyone please help me understand this, many thanks.
-
Nice one mate, I will check these out in php manual, many thanks.
-
Hi there, I am asking if someone could help explain how, after validation of log in details does the php open a new script (html page) rather than using the include function? thanks.
-
Thank-you for the discusion. I think we have got somewhere, many thanks.