PHP - How To Output It?
the print_r($a)'s result is
views_handle_field_node Object ( [view]=>view Object ( [db_table] => views_view [base_table] => node [args] => Array ( [0] => My entry 1 ) [use_ajax] => [result] => Array ( [0] => stdClass Object ( [nid] => 5 [node_title] => Title of a test entry [node_revisions_body] => [node_revisions_format] => 1 [node_vid] => 5 [term_data_name] => My first test term name [term_data_vid] => 1 [term_data_tid] => 1 [vocabulary_name] => Vocabulary 1 [node_revisions_vid] => 5 ) [1]=> stdClass Object ( [nid] => 8 [node_title] => Title of a test entry [node_revisions_body] => [node_revisions_format] => 1 [node_vid] => 5 [term_data_name] => My first test term name [term_data_vid] => 1 [term_data_tid] => 1 [vocabulary_name] => Vocabulary 1 [node_revisions_vid] => 5 .. [2].. .. now i want to output the [nid]=>5 and[nid]=>8.....and all the nid's value.i use this, but can't work. $views_handle_field_node->$view->$result[]->nid. what's the correct output of it. Similar TutorialsWell I have a script that executes a scan on a system set to run infinitely, and I need it to echo out a message each time it loops through, but I don't want it to echo out the message with the next loop message below it, and the next one below that etc... I've tried using the flush(); function and been messing around with that with no luck. For security reasons I don't want to release any of the processing code, but here is the basic construction of the script: <?PHP ***PROCESSING AND SCAN CODE*** ***PROCESSING AND SCAN CODE*** ***PROCESSING AND SCAN CODE*** ***PROCESSING AND SCAN CODE*** $RepeatIt = -1; for($g=1; $g!=$RepeatIt+1; $g++) { ***PROCESSING AND SCAN CODE*** ***PROCESSING AND SCAN CODE*** ***PROCESSING AND SCAN CODE*** ***PROCESSING AND SCAN CODE*** $ScanMessage = ":.:.: SCANNING THE HITLIST FOR MOBSTER: ".$MobName." (SCAN #$g) :.:.:"."<br/><br/>"; echo $ScanMessage; ***PROCESSING AND SCAN CODE*** ***PROCESSING AND SCAN CODE*** ***PROCESSING AND SCAN CODE*** ***PROCESSING AND SCAN CODE*** } ?> At the moment it's returning: :.:.: SCANNING THE HITLIST FOR MOBSTER: DEUS EX DESTROYER (SCAN #1) :.:.: :.:.: SCANNING THE HITLIST FOR MOBSTER: DEUS EX DESTROYER (SCAN #2) :.:.: :.:.: SCANNING THE HITLIST FOR MOBSTER: DEUS EX DESTROYER (SCAN #3) :.:.: :.:.: SCANNING THE HITLIST FOR MOBSTER: DEUS EX DESTROYER (SCAN #4) :.:.: So what I want it to do is just delete the scanning message and replace it with the next scan message so while running this script you would see just the number increment on the same line. Any suggestions? Thanks. Team I tried to create csv output ( every value in double quotes) in my php using below function
if($generate_csv){
function generateCSV($data, $filename) { I got below output with one issue (There is a blank at the end of each value)
Date,time,Device,lable,throughput_read,throughput_write
Could you please help me to resolve this issue Hello. I'm looking for some help to make a script. The script should run a .bat file, and get the output from it. (The text from the console). Regards Worqy Hi, This script lists all the contents of the dir it is placed in bar itself. Perfect for what I need. However, I want to output the results as xml and being new to php I really don't know where to start. <?php foreach (new DirectoryIterator('.') as $file) { if ( (!$file->isDot()) && ($file->getFilename() != basename($_SERVER['PHP_SELF'])) ) { echo ($file->isDir()) ? "(Dir) ".$file->getFilename() : $file->getFilename(); } } ?> I'd be thankful for the help Thanks in advance. Hi. I found a code online but unfortunately, the data is retrieved via variables. How can i convert this code to retrieve the data from database instead. Thank you in ADVANCE! Code: [Select] var members = [ ['Steven B. Ayres', '1911-1913', 'New York', 'Independent Democrat', '1861-1929'], ['William Augustus Ayres', '1915-1921 1923-1934', 'Kansas', 'Democratic', '1867-1952'], ['William Hanes Ayres', '1951-1971', 'Ohio', 'Republican', '1916-2000'] ]; How do I got about outputing one row that can only hold one value? Any reason why the function below doesn't work? Code: [Select] <?php include "database.php"; session_start(); $name = $_session['outname']; function output_wins(){ $sql = 'SELECT * FROM account_info WHERE username ="' . $name .'"'; $result = mysql_query($sql); $wins = mysql_fetch_array($result); echo $wins['win']; } output_wins(); ?> Is there an easier way I can output this one row? Hi all, Is there a simple way to log the command output of a linux console? This command locks up my screen. It is a screen on an Aastra IP phone. $command = 'logsave /var/www/html/aastra/test.log ls'; shell_exec($command); Thanks! hello guys..!!! am new to this phpfreak community...i hav faced some problem while getting on floating point nos addition..if i use echo (int)((0.1+0.7))*10; i am getting output as 7. If i remove (int), i would get output as 8..which is correct... for any other possibilities like ((0.1+0.2))*10 am getting correct output as 3..pls guys help me on this wid proper reason....waiting for solution.... I have created a PHP page where the contents are pulled from DB. Is there a way that I can save the file with the output and stylesheet to PDF with a click of a button. Edited May 5, 2020 by ZulfadlyAshBurnGrammer I don't have any output after I push the button :s I dont know how http://fhcs.be/index3.php Code: [Select] <?php // Include MySQL class require_once('inc/mysql.class.php'); // Include database connection require_once('inc/global.inc.php'); // Include functions session_start(); ?> <?php if (!isset($_POST['submit'])) { ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <form method="post" action="<?php echo $PHP_SELF; ?>"> <input type="submit" value="Toon Output" name="submit"/> <?php $dranken=array() ; $DrinkResult=mysql_query("SELECT name,price FROM products")or die(mysql_error()); while($DrinkRow=mysql_fetch_assoc($DrinkResult)){ $dranken[] = $DrinkRow; } echo "<table>"; foreach ($dranken as $DrinkRow) { $optionlist = "<select name='{$DrinkRow['name']}_aantal'>"; for ($i=0;$i<10;++$i) { $optionlist .= "<option value='$i'>$i</option>"; } $optionlist .= "</select>"; echo "<tr><td>".$DrinkRow['name']." ".$DrinkRow['price']."</td>\n"; echo "<td>$optionlist</td></tr>\n"; } echo "</table>"; ?> </form> <?php } $dranken=array() ; $DrinkResult=mysql_query("SELECT name,price FROM products")or die(mysql_error()); while($DrinkRow=mysql_fetch_assoc($DrinkResult)){ $dranken[] = $DrinkRow; } echo "<table>"; $totaalPrijs = 0; foreach ($dranken as $DrinkRow) { $aantal = $_POST[$DrinkRow['name'] . "_aantal"]; if ($aantal > 0) { $prijsperDrank = $aantal * $DrinkRow['price']; echo $DrinkRow['name'] . " : " . $aantal . " Prijs: " . $prijsperDrank . "</br>"; $totaalPrijs=$totaalPrijs + $prijsperDrank; } } if($totaalPrijs>0){ echo " totaal: " .$totaalPrijs;} ?> </html> Hey folks, I have made a cart for buying drinks. I also made an sql database. But when I click on the email button, I receive an email but only with the id of the products. I would like to have an output with the id of the product, but also the name of the product ( the name of the column in sql is also 'name') this is my code and you can check it out on http://fhcs.be/cart-demo3/ thanks in advance cart.php <?php // Include MySQL class require_once('inc/mysql.class.php'); // Include database connection require_once('inc/global.inc.php'); // Include functions require_once('inc/functions.inc.php'); // Start the session session_start(); // Process actions $cart = $_SESSION['cart']; $action = $_GET['action']; switch ($action) { case 'add': if ($cart) { $cart .= ','.$_GET['id']; } else { $cart = $_GET['id']; } break; case 'delete': if ($cart) { $items = explode(',',$cart); $newcart = ''; foreach ($items as $item) { if ($_GET['id'] != $item) { if ($newcart != '') { $newcart .= ','.$item; } else { $newcart = $item; } } } $cart = $newcart; } break; case 'update': if ($cart) { $newcart = ''; foreach ($_POST as $key=>$value) { if (stristr($key,'qty')) { $id = str_replace('qty','',$key); $items = ($newcart != '') ? explode(',',$newcart) : explode(',',$cart); $newcart = ''; foreach ($items as $item) { if ($id != $item) { if ($newcart != '') { $newcart .= ','.$item; } else { $newcart = $item; } } } for ($i=1;$i<=$value;$i++) { if ($newcart != '') { $newcart .= ','.$id; } else { $newcart = $id; } } } } } $cart = $newcart; break; } $_SESSION['cart'] = $cart; ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>PHP Shopping Cart Demo &#0183; Cart</title> <link rel="stylesheet" href="css/styles.css" /> </head> <body> <div id="shoppingcart"> <h1>Your Shopping Cart</h1> <?php echo writeShoppingCart(); ?> </div> <div id="contents"> <h1>Please check quantities...</h1> <?php echo showCart(); ?> <p><a href="index.php">Back to bookshop...</a></p> <form action="mail.php" method="post"> <input type="submit" name="sendemail" value="Email" /> <input type="hidden" name="cart" value="<?= $cart; ?>" /> </form> </div> </body> </html> mail.php <?php session_start(); if($_POST['sendemail'] == 'Email') { $headers = 'From: Sender <andrej13@gmail.com>'; mail('andrej13@gmail.com', 'Subject', $_SESSION["cart"] , $headers); echo 'Your mail has been sent'; } else { echo 'message not sent'; } ?> and the functions.php <?php function writeShoppingCart() { $cart = $_SESSION['cart']; if (!$cart) { return '<p>You have no items in your shopping cart</p>'; } else { // Parse the cart session variable $items = explode(',',$cart); $s = (count($items) > 1) ? 's':''; return '<p>You have <a href="cart.php">'.count($items).' item'.$s.' in your shopping cart</a></p>'; } } function showCart() { global $db; $cart = $_SESSION['cart']; if ($cart) { $items = explode(',',$cart); $contents = array(); foreach ($items as $item) { $contents[$item] = (isset($contents[$item])) ? $contents[$item] + 1 : 1; } $output[] = '<form action="cart.php?action=update" method="post" id="cart">'; $output[] = '<table>'; foreach ($contents as $id=>$qty) { $sql = 'SELECT * FROM products WHERE id = '.$id; $result = $db->query($sql); $row = $result->fetch(); extract($row); $output[] = '<tr>'; $output[] = '<td><a href="cart.php?action=delete&id='.$id.'" class="r">Remove</a></td>'; $output[] = '<td>'.$name.'</td>'; $output[] = '<td>€'.$price.'</td>'; $output[] = '<td><input type="text" name="qty'.$id.'" value="'.$qty.'" size="3" maxlength="3" /></td>'; $output[] = '<td>€'.($price * $qty).'</td>'; $total += $price * $qty; $output[] = '</tr>'; } $output[] = '</table>'; $output[] = '<p>Grand total: <strong>€'.$total.'</strong></p>'; $output[] = '<div><button type="submit">Update cart</button></div>'; $output[] = '</form>'; } else { $output[] = '<p>You shopping cart is empty.</p>'; } return join('',$output); } ?> I'm not getting any errors but I"m not getting the output I'm expecting. When it gets the characterIDList values if there is a value for that field it needs to take that value then explode it and get the ID and characterName of each of the values so say the value inside of characterIDList was 2,3 then for each of those values it would find the characterName and ID of the value and be able to put each of them as a LI inside the UL. I was hoping I could have the charactersQuery separate because I use it for the dropdown. Code: [Select] $newsQuery = " SELECT news.categoryID, news.newsTitle, news.newsPicture, news.content, news.characterIDList FROM news LEFT JOIN categories ON news.categoryID = categories.ID WHERE news.ID = '" . $newsID . "'"; $newsResult = mysqli_query ( $dbc, $newsQuery ); // Run The Query echo $newsQuery; $row = mysqli_fetch_array ( $newsResult, MYSQL_ASSOC ); $characterIDList = $row[ 'chracterIDList' ]; $characterIDList = explode(',', $characterIDList); foreach($characterIDList as $value){ $charactersQuery = " SELECT ID, characterName FROM characters ORDER BY characters.characterName"; $charactersResult = mysqli_query ( $dbc, $charactersQuery ); // Run The Query } Code: [Select] <div class="field required"> <label for="charactersDrop">Characters Involved</label> <ul id="characterList" style="list-style: none; margin-left: 195px;"> <?php mysqli_data_seek( $charactersResult, 0 ); while($row = mysqli_fetch_array ( $newsResult, MYSQL_ASSOC )) { if ($row['characterName'] == NULL ) { } else { ?> <li characterID="<?php echo $row['ID']; ?>" characterName="<?php echo htmlentities( $row['characterName'] ); ?>"><?php echo htmlentities($row['characterName']); ?> <a href="#">Remove</a></li> <?php }} ?> </ul> <select class="dropdown" name="charactersDrop" id="charactersDrop" title="Characters Dropdown" style="margin-left: 195px;"> <option value="">- Select -</option> <?php mysqli_data_seek( $charactersResult, 0 ); while ( $row = mysqli_fetch_array ( $charactersResult, MYSQL_ASSOC ) ) { print "<option value=\"".$row['ID']."\">".$row['characterName']."</option>\r"; } ?> </select> <input type="button" value="Add Character" class="" onclick="CharactersInvolved()"/> </div> I have a function which is listing my directories w/ files (Images) in them. <?php function sortDirectory($path = 'images') { $ignore = array('.', '..', 'index.php'); $folder = array(); $dh = @opendir($path); while (false !== ( $file = readdir($dh) )) { if (!in_array($file, $ignore)) { if (is_dir("$path/$file")) { $folder[$file] = sortDirectory("$path/$file"); } else { $folder[$file] = "$path/$file"; } } } closedir($dh); ksort($folder); return $folder; } function getDirectory($folder = array(),$level = 0) { // Set which extensions should be approved in the XML file $extensions = array( 'jpg', 'JPG', 'png', 'PNG', 'gif', 'GIF', 'bmp', 'BMP'); $spaces = str_repeat(' ', ( $level * 4)); foreach($folder as $file=>$path) { if (is_array($path)) { echo "<strong>$spaces $file</strong><br />"; getDirectory($path, $level+1); } else { if ( in_array( substr($file, -3), $extensions ) ){ echo "$spaces <a href=\"$path\">$file</a><br />"; } } } } getDirectory(sortDirectory()); ?> Im trying to get it to write an xml file in this fashion Code: [Select] <?xml version="1.0" encoding="utf-8" standalone="yes"?> <dir1> <pic> <image>file1.jpg</image> </pic> <pic> <image>file2.jpg</image> </pic> </dir1> <dir2> <pic> <image>file1.jpg</image> </pic> <pic> <image>file2.jpg</image> </pic> </dir2>but I cannot seem to get a grasp on this simplexml for more than 1 directory - any help appreciated.? help me. i have an index.php file in admin folder. this is the code inside the file: Code: [Select] <?php ?> Or any other code and i get output 0 , but if i echo something else then i get the string has output, help find out what is the problam please!!! Hi, I am using a form to collect text data, and then spitting it out in an email. I need help formatting the way it looks in the email. How can I modify the following code so that it displays with the name of the award in the left cell and the winner (collected from the form) in the right cell. Left cell should justify to the right and right cell justify to the left and be bold. Any help would be great. Thanks. $message = "A nomination form has been received. Nominees a \r\n\r\n"; $message .= "Ray O. Duncan Award: $duncan\r\n\r\n"; $message .= "Honor Award: $honor\r\n\r\n"; $message .= "Young Professional Award: $young\r\n\r\n"; $message .= "Bea N. Orr Student Award: $orr\r\n\r\n"; $message .= "Scholar Award: $scholar\r\n\r\n"; $message .= "Ethnic Minority Grad Fellow Award: $gradfellow\r\n\r\n"; $message .= "Recreation/Leisure Leadership Award: $rec\r\n\r\n"; $message .= "Elementary Teacher of the Year: $etoy\r\n\r\n"; $message .= "Middle School Teacher of the Year: $mtoy\r\n\r\n"; $message .= "High School Teacher of the Year: $htoy\r\n\r\n"; $message .= "K12 Dance Educator of the Year: $danceEd\r\n\r\n"; $message .= "Health Educator of the Year: $health\r\n\r\n"; Hey folks, I have made a cart. My output of the cart ( when I receive a mail of the order ) is like this "3,2,4,2" ,, the numbers are the id's of the items, but instread of the id's of the items, I would like to have the names of the items as an output in mail.php, column in sql table is also 'name' what should I do ?? the cart http://fhcs.be/cart-demo4/ thanks in advance index.php <?php // Include MySQL class require_once('inc/mysql.class.php'); // Include database connection require_once('inc/global.inc.php'); // Include functions require_once('inc/functions.inc.php'); // Start the session require_once('mail.php'); session_start(); ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>PHP Shopping Cart Demo &#0183; Bookshop</title> <link rel="stylesheet" href="css/styles.css" /> </head> <body> <div id="shoppingcart"> <h1>Welkom, plaats uw order</h1> </div> <div id="booklist"> <h1>Warme dranken</h1> <?php $sql = 'SELECT * FROM products WHERE cat=2'; $result1 = $db->query($sql); $output1[] = '<ul>'; while ($row = $result1->fetch()) { $output1[] = '<li>'.$row['name'].': €'.$row['price'].'<br /><a href="cart.php?action=add&id='.$row['id'].'">Add to cart</a></li>'; } $output1[] = '</ul>'; echo join('',$output1); ?> <h1>Cocktails</h1> <?php $sql = 'SELECT * FROM products WHERE cat=3'; $result2 = $db->query($sql); $output2[] = '<ul>'; while ($row = $result2->fetch()) { $output2[] = '<li>'.$row['name'].': €'.$row['price'].'<br /><a href="cart.php?action=add&id='.$row['id'].'">Add to cart</a></li>'; } $output2[] = '</ul>'; echo join('',$output2); ?> </div> </body> </html> mail.php <?php // Include MySQL class require_once('inc/mysql.class.php'); // Include database connection require_once('inc/global.inc.php'); session_start(); if($_POST['sendemail'] == 'Email') { $info =($_POST['cart']); $headers = 'From: Sender <from@fhcs.be>'; mail('to@fhcs.be', 'Subject', $info, $headers); echo $_POST["cart"]; echo 'Your mail has been sent'; } else { echo 'Your mail was not sent'; } ?> cart.php <?php function writeShoppingCart() { $cart = $_SESSION['cart']; if (!$cart) { return '<p>You have no items in your shopping cart</p>'; } else { // Parse the cart session variable $items = explode(',',$cart); $s = (count($items) > 1) ? 's':''; return '<p>You have <a href="cart.php">'.count($items).' item'.$s.' in your shopping cart</a></p>'; } } function showCart() { global $db; $cart = $_SESSION['cart']; if ($cart) { $items = explode(',',$cart); $contents = array(); foreach ($items as $item) { $contents[$item] = (isset($contents[$item])) ? $contents[$item] + 1 : 1; } $output[] = '<form action="cart.php?action=update" method="post" id="cart">'; $output[] = '<table>'; foreach ($contents as $id=>$qty) { $sql = 'SELECT * FROM products WHERE id = '.$id; $result = $db->query($sql); $row = $result->fetch(); extract($row); $output[] = '<tr>'; $output[] = '<td><a href="cart.php?action=delete&id='.$id.'" class="r">Remove</a></td>'; $output[] = '<td>'.$name.'</td>'; $output[] = '<td>€'.$price.'</td>'; $output[] = '<td><input type="text" name="qty'.$id.'" value="'.$qty.'" size="3" maxlength="3" /></td>'; $output[] = '<td>€'.($price * $qty).'</td>'; $total += $price * $qty; $output[] = '</tr>'; } $output[] = '</table>'; $output[] = '<p>Grand total: <strong>€'.$total.'</strong></p>'; $output[] = '<div><button type="submit">Update cart</button></div>'; $output[] = '</form>'; } else { $output[] = '<p>You shopping cart is empty.</p>'; } return join('',$output); } ?> functions.php <?php function writeShoppingCart() { $cart = $_SESSION['cart']; if (!$cart) { return '<p>You have no items in your shopping cart</p>'; } else { // Parse the cart session variable $items = explode(',',$cart); $s = (count($items) > 1) ? 's':''; return '<p>You have <a href="cart.php">'.count($items).' item'.$s.' in your shopping cart</a></p>'; } } function showCart() { global $db; $cart = $_SESSION['cart']; if ($cart) { $items = explode(',',$cart); $contents = array(); foreach ($items as $item) { $contents[$item] = (isset($contents[$item])) ? $contents[$item] + 1 : 1; } $output[] = '<form action="cart.php?action=update" method="post" id="cart">'; $output[] = '<table>'; foreach ($contents as $id=>$qty) { $sql = 'SELECT * FROM products WHERE id = '.$id; $result = $db->query($sql); $row = $result->fetch(); extract($row); $output[] = '<tr>'; $output[] = '<td><a href="cart.php?action=delete&id='.$id.'" class="r">Remove</a></td>'; $output[] = '<td>'.$name.'</td>'; $output[] = '<td>€'.$price.'</td>'; $output[] = '<td><input type="text" name="qty'.$id.'" value="'.$qty.'" size="3" maxlength="3" /></td>'; $output[] = '<td>€'.($price * $qty).'</td>'; $total += $price * $qty; $output[] = '</tr>'; } $output[] = '</table>'; $output[] = '<p>Grand total: <strong>€'.$total.'</strong></p>'; $output[] = '<div><button type="submit">Update cart</button></div>'; $output[] = '</form>'; } else { $output[] = '<p>You shopping cart is empty.</p>'; } return join('',$output); } ?>
This is a file called t12.php <?php include 'db.php'; error_reporting(E_ALL | E_WARNING | E_NOTICE); ini_set('display_errors', TRUE); if (session_status() == PHP_SESSION_NONE) { session_start(); } if(!isset($_SESSION['login'])) { echo (" <script>location.href='../clogin/'</script>"); die(); if(isset($_POST['transfer'])) { $username = $_SESSION['login']; $transAmount = $_POST['transAmount']; $totalTrans = $transAmount + 30; $sql = "SELECT * FROM customer WHERE username = ?"; $stmt = $connection->prepare($sql); $stmt->bind_param('s', $username); $stmt->execute(); $result = $stmt->get_result(); $count = $result->num_rows; if($count == 1) { while ($row = $result->fetch_assoc()) { if($totalTrans > $row['transLimit']) { echo 'you have exceeded limit'; exit(); } else { echo"limit passed"; } }//while loop }//count }//submit }//session ?>
<form action="t12.php" method="post"> <input type="number" name="transAmount" placeholder="Enter Amount"> </input><br> <button type="submit" name="transfer">Proceed</button></form>
Code: [Select] <?php if (!isset($_POST['submit'])) { ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <form method="post" action="<?php echo $PHP_SELF; ?>"> <input type="submit" value="Toon Output" name="submit"/> <?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>"; ?> </form> <?php } $dranken = array("cola", "fanta", "bier", "koffie", "thee"); $prijzen = array("2", "2", "1.80", "2.20", "2.20"); $i = 0; $totaalPrijs = 0; while ($dranken[$i]) { $aantal = $_POST[$dranken[$i] . "_aantal"]; if ($aantal > 0) { $prijsperDrank = $aantal * $prijzen[$i]; echo $dranken[$i] . " : " . $aantal . " Prijs: " . $prijsperDrank . "</br>"; $totaalPrijs += $prijsperDrank; echo " totaal: $totaalPrijs"; } $i++; } ?> </html> My output is like this cola : 2 Prijs: 4 totaal: 4fanta : 1 Prijs: 2 totaal: 6 but I want it like this cola : 2 Prijs: 4 fanta : 1 Prijs: 2 totaal: 6 Thanks in advance: price = prijs, totaal = total, dranken = drinks Im trying to figure out why my installation of xcart, when I go to the /admin directory, it redirects to my live admin login page. I have a development (http://development.website.com) and a live (http://website.com) installation. When I go to http://development.website.com/admin it redirects me to http://website.com/admin. I'm trying to output the PHP code from the page after executing. Isn't there someway to do something like echo __FILE_CONTENTS__; or something like that? If you have any input about my main problem any advice will be appreciated! Mongoose Using Windows, how do you redirect the output, something similar to /dev/null? I tried this: shell_exec("php ./myScript.php arg1 arg2 arg3 >/dev/null"); but I am getting this error: The system cannot find the path specified. So, how do I redirect the output in Windows? |