Jump to content

osiris1603

New Members
  • Posts

    4
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

osiris1603's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thank you for your help, although I changed the value of the get_info <?php $status = "SELECT status FROM orders WHERE id = $id"; $orderstat = mysql_query ($status); while ($get_info = mysql_fetch_row($orderstat)){ foreach ($get_info as $orderstatus) print "$orderstatus"; } $options = array ("Pending", "Processing", "Completed", "Dispatched", "Not Cleared", "Cancelled"); $status = mysql_query ("SELECT status FROM orders WHERE id = ". $id); $get_info = mysql_fetch_row($status); // changed this line $orderstatus = $get_info[0]; $form = '<select name="status">'."\n"; foreach ( $options as $option ) { $selected = ( $orderstatus == $option ) ? ' selected="selected"' : ''; $form .= '<option value="'. $option .'"'. $selected .'>'. $option .'</option>'."\n"; } $form .= '</select>'; print $form; ?>
  2. Hi, I have this so that the select drop down menu gives the option/value of the "status" so it is selected in the drop down menu, so if the status was "Processing" then the first option shown in the <select> would be "Processing" instead of the pre-defined first option "Pending". Although, I am not sure why this is not giving the correct output, as it still stays at "Pending"... Does anyone know how I can resolve this? <?php $status = "SELECT status FROM orders WHERE id = $id"; $orderstat = mysql_query ($status); while ($get_info = mysql_fetch_row($orderstat)){ foreach ($get_info as $orderstatus) print "$orderstatus"; } $options = array ("Pending", "Processing", "Completed", "Dispatched", "Not Cleared", "Cancelled"); $status = mysql_query ("SELECT status FROM orders WHERE id = ". $id); $get_info = mysql_fetch_row($orderstat); $orderstatus = $get_info[0]; $form = '<select name="status">'."\n"; foreach ( $options as $option ) { $selected = ( $orderstatus == $option ) ? ' selected="selected"' : ''; $form .= '<option value="'. $option .'"'. $selected .'>'. $option .'</option>'."\n"; } $form .= '</select>'; print $form; ?> Many thanks in advance...
  3. conker87 Thank you very much for your code and help, it works the way I have been trying to achieve! If there is a reputation system on this forum I will give you some. Thank you very, very much!
  4. I wrote this code which works fine until I enter the else echo content of which is a link that contains more PHP coding: <? $buynow = "SELECT availability FROM productlist WHERE id = 60"; $buylink = mysql_query ($buynow); while ($get_info = mysql_fetch_row($buylink)){ foreach ($get_info as $buynowlink) if ( $buynowlink == "SORRY, CURRENTLY NOT IN STOCK" ) { echo "<DEL>Buy Now</DEL>"; } else echo "<script type=\"text/javascript\">document.write('<a href=\"cart.php?action=add_item&cartid=<? echo $PHPSESSID; ?>&product=Excel Bells Large&price=<? $cost = \"SELECT price FROM productlist WHERE id = 60\"; $price = mysql_query ($cost); while ($get_info = mysql_fetch_row($price)){ foreach ($get_info as $productprice) print \"$productprice\"; } ?>&qty=1\" rel=\"facebox[.thickstyle]\">Buy Now</a>');</script> <noscript><a href=\"add_item_njs.php?cartid=<? echo $PHPSESSID; ?>&product=<? $product = \"SELECT productname FROM productlist WHERE id = 60\"; $nameofproduct = mysql_query ($product); while ($get_info = mysql_fetch_row($nameofproduct)){ foreach ($get_info as $productname) print \"$productname\"; } ?>&price=<? $cost = \"SELECT price FROM productlist WHERE id = 60\"; $price = mysql_query ($cost); while ($get_info = mysql_fetch_row($price)){ foreach ($get_info as $productprice) print \"$productprice\"; } ?>&qty=1\">Buy Now</a></noscript>"; } ?> As you can see there is <? ?> within the links which call data from the database such as price etc. which is needed. However when I try this out it does not give any output as the <? ?> within the echo is not allowing it to (i think?). Does anyone know how I can solve this? Many thanks in advance!
×
×
  • 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.