Jump to content

Visibility of variables?


ibexy

Recommended Posts

I am working in joomla. What happens here is that I am retrieving values from a atble and then assingning a text box and and a button to each line. As each line is treived, I assigne the values to the variable declared global (see green shaded area). Later, I try to store these values in a table in the $_POST action for the buttons (See brown shaed areas). Its working fine. My problem is that nothing is being stored.

 

(I have edited the program to make it shorter)

 

<?

 

global $database, $ueConfig, $my, $mosConfig_lang, $mainframe, $mosConfig_live_site, $_SERVER, $Itemid, $m_id,$m_description,$m_price;

 

$gjp_path = $mosConfig_absolute_path.'/components/com_comprofiler/plugin/user/plug_groupjivetab';

 

 

$absolute_path = $mainframe->getCfg('absolute_path');

 

 

 

// Function buystuff

 

if(isset($_POST['txtbuy'])){

 

  $qty_bought=$_POST['txtbuy'];

 

 

$query = "INSERT INTO #__joe_bought_items SET item_id='$m_id',description='$m_description', qty='$qty_bought',price= '$m_price', buyer_id='$my->id'";

 

$database->setQuery( $query );

$database->query() or die( $database->stderr() );

 

 

}

 

//  End Buy Stuff

 

{Other codes}

 

?>

<div align="center">

</p>

</p>

 

{other codes}

 

<?

 

 

$name_of_txt_box="txtbuy";

$type_of_txt_box="text";

$size_of_txt_box="8";

$post_method="POST";

$action_to_call="components/com_dailymessage/buy_shares.php";

$box_style="margin-top: 0; margin-bottom: 0";

$button_input_type="submit";

$button_value="Buy";

$button_name="btnbuy";

 

foreach($rows as $row)

{

 

 

// IBEX

$m_id=$row->id;

$m_description=$row->description;

$m_qty=$row->qty;

$m_price=$row->price;

 

 

 

echo "<tr>";

echo "<td>" . $starttags . $row->id . $endtags . "</td>";

echo "<td>" . $starttags . $row->item . $endtags . "</td>";

echo "<td>" . $starttags . $row->description . $endtags . "</td>";

echo "<td>" . $starttags . $row->qty . $endtags . "</td>";

 

 

if ($row->item == 'Shares')

echo "<td>" . $starttags . $system_share_value  . $endtags . "</td>";

else

echo "<td>" . $starttags . $row->price . $endtags . "</td>";

 

 

if ($total_credit >= $row->price) {

 

 

// Below without action parameter

echo "<td><form method=".$post_method."><p style=".$box_style."><input type=".$type_of_txt_box ."

name=".$name_of_txt_box." size=".$size_of_txt_box."><input type=".$button_input_type." value=".$button_value."

name=".$button_name."</p></form></td>";

 

 

 

// ibex old codes:   echo "<td><a href=" . $row->action . ">buy</a></td></tr>";

 

}

else {

echo "<td>Unaffordable</td></tr>";

 

 

}

 

}

 

?></table>

 

 

</div>

 

 

</br>

 

 

<?

{other codes}

 

?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.