Jump to content

Kano

Members
  • Posts

    76
  • Joined

  • Last visited

    Never

Everything posted by Kano

  1. 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.
  2. 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?
  3. Thanks, thorpe. A dot at each end, I put one before the assignment operator but never considered after the variable, cool.
  4. 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.
  5. 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.
  6. Kano

    $_POST

    oops, I think session_start() may help.
  7. Kano

    $_POST

    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.
  8. sweat, thanks guys.
  9. 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.
  10. 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.
  11. 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>";
  12. 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.
  13. 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>";
  14. 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.
  15. Kano

    <select>

    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.
  16. Kano

    <select>

    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.
  17. Kano

    <select>

    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.
  18. oops my mistake you created variables previously
  19. HI there, should you select statements where ....... = ('$_post[]'); ??
  20. Kano

    log in

    does anyone know why that worked??
  21. Kano

    log in

    Problem solved: I change the file encoding from utf-8 to ansi and that worked, thanks for the help.
  22. Kano

    log in

    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.
  23. Kano

    log in

    Nice one mate, I will check these out in php manual, many thanks.
  24. Kano

    log in

    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.
  25. Thank-you for the discusion. I think we have got somewhere, many thanks.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.