Results 1 to 8 of 8

Thread: [RESOLVED] $_POST problem

  1. #1

    Thread Starter
    Lively Member
    Join Date
    May 2004
    Location
    London
    Posts
    107

    Resolved [RESOLVED] $_POST problem

    I have a series of webforms, that all look at the following .php script when a button is clicked (i.e. form action is set to post).

    The script is firing, so this works correctly, however the results are not as expected...

    Here is my code (I've taken out the server, db etc. variables, but they are correct and this part of the code works as expected):

    <?php

    include_once('functions.php');

    if (isset($_POST['bonddescription']))
    {
    include_once('reduced_view_issues.php');
    include_once('select_issue.php');
    }

    if (isset($_POST["btnedit"]))
    {
    include_once('reduced_view_issues.php');
    include_once('select_issue2.php');
    }

    if (isset($_POST["btnupdate"]))
    {
    include_once('reduced_view_issues.php');
    include_once('select_issue2.php');
    }

    if (isset($_POST["btncancel"]))
    {
    include_once('reduced_view_issues.php');
    include_once('select_issue.php');
    }


    if (isset($_POST["btndelete"]))
    {
    $delete=max($_POST['issueid']);
    $bond_description=max($_POST['bonddescription']);

    $db = new mysqli($server_name, $user_name, $password, $database_name);
    $query = "call sp_delete_issue(".$delete.")";
    $result = $db->query($query);
    $db->close();
    break;
    include_once('reduced_view_issues.php');
    echo $bond_description." has been deleted".$delete;

    }

    ?>

    1) When I click on a button on the form 'reduced_view_issues.php' ['bonddescription'] is posted and it then brings up 'select_issue.php' beneath it (this form is a detailed version of the row the button was clicked from), this appears to work correctly.

    2) When I click on btnedit on the form 'select_issue.php', 'reduced_view_issues.php' remains on screen, 'select_issue.php' is replaced by 'select_issue2.php', therefore this also appears to work correctly.

    3) If I click btncancel on the form 'select_issue2.php', 'reduced_view_issues.php' and 'select_issue.php' are shown on screen, therefore this appears to function correctly.

    These next 2 are where the behaviour is not as expected:

    4) If I click btndelete, the record is deleted, so the correct 'issusid' is being posted and the SQL code functions correctly. However the $bond_description does not show (oddly it did previously when I didn't execute the SQL code in the script) and instead of just 'reduced_view_issues.php' showing as expected, 'select_issue.php' also shows underneath it. I do not know why this is happening?

    5) If I click btnupdate (there is no SQL as yet, I wanted to get the php working first), then it shows 'reduced_view_issues.php', 'select_issue.php' and 'select_issue2.php' in that order, the expected behaviour is to show just 'reduced_view_issues.php' and 'select_issue2.php'.

    I can't see anything wrong, but obviously there must be something, can anyone help?

    I am hoping this is a very simple fix, as it shouldn't be a complex issue!

  2. #2
    Smooth Moperator techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,532

    Re: $_POST problem

    What does the html form look like where these buttons are? Logically it looks right... but I wonder if maybe there's a mix up in the values that the forms are passing over...

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  3. #3

    Thread Starter
    Lively Member
    Join Date
    May 2004
    Location
    London
    Posts
    107

    Re: $_POST problem

    Here is 'select_issue2.php', I've included the whole page, as its just one form, which I believe is posting correctly (bar the issues mentioned above):

    <html>
    <head>
    <title>View Issues</title>
    </head>
    <body marginheight="0" topmargin="0" marginwidth="0"
    leftmargin="0" style="margin:0;padding:0" bgcolor="#B0E0E6">
    <h1></h1>

    <form action="select_issue3.php" method="post">
    <?php

    include_once('functions.php');

    $issueid=max($_POST['issueid']);

    $result_array=get_dataset($server_name, $user_name, $password, $database_name,"call sp_select_issue(".$issueid.")");

    ?>

    <table border="2" style="border:solid black" cellpadding="1" cellspacing="0" width="100%" bgcolor='white'>
    <tr>
    <td>
    <table>
    <td>
    <input type='submit' id='btnupdate' name='btnupdate' value='Update Bond' >
    </td>
    <td>
    <input type='submit' name='btncancel'id='btncancel' value='Cancel Updates' >
    </td>
    <td>
    <input type='submit' name='btndelete'id='btndelete' value='Delete Bond' >
    </td>
    </table>
    </td>
    </tr>


    <?php
    $irow=0;
    foreach ($result_array as $row)
    {

    $bond_description = $row['description'];
    $bond_issue_id = $row['issue_id'];

    ?>


    <td><table width='100%'>

    <tr>
    <td>
    Description
    </td>
    <td>
    <?php echo "<input type='Text' width='100%' id='bond_description' name='bonddescription[]' value='" .$row['description']. "'>";?>
    <?php echo "<input type='hidden' id='issue_id' name='issueid[]' value='".$row['issue_id']."'>";?>
    </td>
    </tr>
    <tr>
    <td align="left">Notes</td>
    <td>
    <?php echo "<input type='Text' size='50' id='notes' name='notes[]' value='" .$row['notes']. "'>";?>
    </td>
    </tr>
    </table>
    </td>
    <td>
    <table width='100%'>
    <tr>
    <td align="left">Currency</td>
    <td>
    <?php drop_down('currency_id[]','currency_id','currency_id','currency_ticker',$server_name, $user_name, $password, $database_name,"call sp_currency",$row);?>
    </td>
    </tr>
    <tr>
    <td align="left">Coupon</td>
    <td>
    <?php echo "<input type='Text' width='100%' id='coupon' name='coupon[]' value='" .$row['coupon']. "'>";?>
    </td>
    </tr>

    <tr>
    <td align="left">Coupon Type</td>
    <td>
    <?php drop_down('coupon_type_id[]','coupon_type_id','coupon_type_id','coupon_type_name',$server_name, $user_name, $password, $database_name,"call sp_coupon_type",$row);?>
    </td>
    </tr>
    <tr>
    <td align="left">Coupon Frequency</td>
    <td>
    <?php drop_down('coupon_frequency_id[]','coupon_frequency_id','coupon_frequency_id','coupon_frequency_code',$server_name, $user_name, $password, $database_name,"call sp_coupon_frequency",$row);?>
    </td>
    </tr>
    <tr>
    <td align="left">Day Count</td>
    <td>
    <?php drop_down('day_count_id[]','day_count_id','day_count_id','day_count_name',$server_name, $user_name, $password, $database_name,"call sp_day_count",$row);?>
    </td>
    </tr>
    </table>
    </td>

    <td>
    <table width='100%' height='100%'>
    <tr>
    <td>
    Bookrunners
    </td>
    <td>
    Exchanges
    </td>
    </tr>
    <tr>
    <td>
    <?php drop_down('bookrunnerid[]','institution_id','institution_id','bond_ticker',$server_name, $user_name, $password, $database_name,"call sp_bookrunner_eligible",$row,'3',"call sp_bookrunner(".$bond_issue_id.")",'institution_id');?>
    </td>
    <td>
    <?php drop_down('exchangeid[]','exchange_id','exchange_id','exchange_code',$server_name, $user_name, $password, $database_name,"call sp_exchange(1)",$row,'3',"call sp_exchange_issue(".$bond_issue_id.")",'exchange_id');?>
    </td>
    </tr>
    </table>
    </td>

    <td>

    <table width='100%'>

    <tr>
    <td align="left">Price To</td>
    <td>
    <?php drop_down('price_to_id[]','price_to_id','price_to_id','price_to_name',$server_name, $user_name, $password, $database_name,"call sp_price_to",$row);?>
    </td>
    </tr>

    <tr>
    <td align="left">Quote Convention</td>
    <td>
    <?php drop_down('quote_convention_id[]','quote_convention_id', 'quote_convention_id', 'quote_convention_name',$server_name, $user_name, $password, $database_name,"call sp_quote_convention(1)",$row);?>
    </td>
    </tr>
    </table>

    </td>
    </tr>

    <tr>
    <td>
    <table width='100%'>
    <tr>
    <td align="left">Issuer</td>
    <td>
    <?php drop_down('issuer_id[]','issuer_id', 'institution_id', 'institution_name',$server_name, $user_name, $password, $database_name,"call sp_institution",$row);?>
    </td>
    </tr>
    <tr>
    <td align="left">Guarantor</td>
    <td>
    <?php drop_down('guarantor_id[]','guarantor_id', 'institution_id', 'institution_name',$server_name, $user_name, $password, $database_name,"call sp_institution",$row);?>
    </td>
    </tr>
    <tr>
    <td align="left">Sub Sector</td>
    <td>
    <?php drop_down('sub_sector_id[]','sub_sector_id','sub_sector_id','sub_sector_name',$server_name, $user_name, $password, $database_name,"call sp_sub_sector",$row);?>
    </td>
    </tr>
    <tr>
    <td align="left">Market</td>
    <td>
    <?php drop_down('market_id[]','market_id','market_id','market_name',$server_name, $user_name, $password, $database_name,"call sp_market",$row);?>
    </td>
    </tr>
    </table>
    </td>

    <td>
    <table width='100%'>
    <tr>
    <td align="left">CUSIP</td>
    <td>
    <?php echo "<input type='Text' width='100%' id='cusip' name='cusip[]' value='" .$row['cusip']. "'>";?>
    </td>
    </tr>
    <tr>
    <td align="left">Bloomberg Number</td>
    <td>
    <?php echo "<input type='Text' width='100%' id='bloomberg_number' name='bloomberg_number[]' value='" .$row['bloomberg_number']. "'>";?>
    </td>
    </tr>
    <tr>
    <td align="left">ISIN</td>
    <td>
    <?php echo "<input type='Text' width='100%' id='isin' name='isin[]' value='" .$row['isin']. "'>";?>
    </td>
    </tr>
    </table>
    </td>

    <td>
    <table width='100%'>
    <tr>
    <td align="left">Moody</td>
    <td>
    <?php echo "<input type='Text' width='100%' id='moody' name='moody[]' value='" .$row['moody']. "'>";?>
    </td>
    </tr>
    <tr>
    <td align="left">Fitch</td>
    <td>
    <?php echo "<input type='Text' width='100%' id='fitch' name='fitch[]' value='" .$row['fitch']. "'>";?>
    </td>
    </tr>
    <tr>
    <td align="left">S&P</td>
    <td>
    <?php echo "<input type='Text' width='100%' id='sandp' name='sandp[]' value='" .$row['sandp']. "'>";?>
    </td>
    </tr>
    </table>
    </td>


    <td>
    <table width='100%'>
    <td align="left">Capital Type</td>
    <td>
    <?php drop_down('capital_id[]','capital_id','capital_id','capital_name',$server_name, $user_name, $password, $database_name,"call sp_capital",$row);?>
    </td>
    </tr>
    <tr>
    <td align="left">Collateral Type</td>
    <td>
    <?php drop_down('collateral_type_id[]','collateral_type_id','collateral_type_id','collateral_type_name',$server_name, $user_name, $password, $database_name,"call sp_collateral_type",$row);?>
    </td>
    </tr>
    </table>
    </td>

    </tr>
    <tr>
    <td>
    <table width='100%'>
    <tr>
    <td align='right'>Bid ASW</td>
    <td align='center'></td>
    <td align='left'>Ask ASW</td>
    <td align='right'>Bid Sprd</td>
    <td align='center'></td>
    <td align='left'>Ask Sprd</td>
    <td align='right'>Bid Price</td>
    <td align='center'></td>
    <td align='left'>Ask Price</td>
    <td align='right'>Bid YTC</td>
    <td align='center'></td>
    <td align='left'>Ask YTC</td>
    <td align='right'>Bid YTM</td>
    <td align='center'></td>
    <td align='left'>Ask YTM</td>
    <td>Date</td>
    <td>Time</td>
    <td>Source</td>
    </tr>

    <?php

    $result_array=get_dataset($server_name, $user_name, $password, $database_name,"call sp_last_price(".$bond_issue_id.",5)");

    $irow=0;
    foreach ($result_array as $row1)
    {

    ?>

    <td align='right'>
    <?php echo "<input type='Text' size='7' id='bid_asw' name='bid_asw[]' value='" .$row1['bid_asw']. "'>";?>
    </td>
    <td align='center'>
    /
    </td>
    <td align='left'>
    <?php echo "<input type='Text' size='7' id='ask_asw' name='ask_asw[]' value='" .$row1['ask_asw']. "'>";?>
    </td>
    <td align='right'>
    <?php echo "<input type='Text' size='7' id='bid_sprd' name='bid_sprd[]' value='" .$row1['bid_sprd']. "'>";?>
    </td>
    <td align='center'>
    /
    </td>
    <td align='left'>
    <?php echo "<input type='Text' size='7' id='ask_sprd' name='ask_sprd[]' value='" .$row1['ask_sprd']. "'>";?>
    </td>
    <td align='right'>
    <?php echo "<input type='Text' size='7' id='bid_price' name='bid_price[]' value='" .$row1['bid_price']. "'>";?>
    </td>
    <td align='center'>
    /
    </td>
    <td align='left'>
    <?php echo "<input type='Text' size='7' id='ask_price' name='ask_price[]' value='" .$row1['ask_price']. "'>";?>
    </td>
    <td align='right'>
    <?php echo "<input type='Text' size='7' id='bid_ytc' name='bid_ytc[]' value='" .$row1['bid_ytc']. "'>";?>
    </td>
    <td align='center'>
    /
    </td>
    <td align='left'>
    <?php echo "<input type='Text' size='7' id='ask_ytc' name='ask_ytc[]' value='" .$row1['ask_ytc']. "'>";?>
    </td>
    <td align='right'>
    <?php echo "<input type='Text' size='7' id='bid_ytm' name='bid_ytm[]' value='" .$row1['bid_ytm']. "'>";?>
    </td>
    <td align='center'>
    /
    </td>
    <td align='left'>
    <?php echo "<input type='Text' size='7' id='ask_ytm' name='ask_ytm[]' value='" .$row1['ask_ytm']. "'>";?>
    </td>
    <td>
    <?php echo "<input type='Text' size='10' id='price_date' name='price_date[]' value='" .$row1['price_date']. "'>";?>
    </td>
    <td>
    <?php echo "<input type='Text' size='8' id='price_date' name='price_time[]' value='" .$row1['price_time']. "'>";?>
    </td>
    <td>
    <?php drop_down('exchange_code[]','exchange_id','exchange_id','exchange_code',$server_name, $user_name, $password, $database_name,"call sp_exchange(1)",$row1);?>
    </td>

    </tr>

    <?php

    $irow++;
    }

    $db1->close;

    ?>

    </table>
    </td>
    <td>
    <table width='100%'>
    <tr>
    <td align="left">Issue Benchmark</td>
    <td>
    <?php drop_down('issue_benchmark_id[]','issue_benchmark_id','issue_id','description',$server_name, $user_name, $password, $database_name,"call sp_benchmark",$row);?>
    </td>
    </tr>
    <tr>
    <td align="left">Current Benchmark</td>
    <td>
    <?php drop_down('current_benchmark_id[]','current_benchmark_id','issue_id','description',$server_name, $user_name, $password, $database_name,"call sp_benchmark",$row);?>
    </td>
    </tr>
    <tr>
    <td align="left">Issue Swap Spread</td>
    <td>
    <?php echo "<input type='Text' width='100%' id='issue_swap_spread' name='issue_swap_spread[]' value='" .$row['issue_swap_spread']. "'>";?>
    </td>
    </tr>
    <tr>
    <td align="left">Issue Benchmark Spread</td>
    <td>
    <?php echo "<input type='Text' width='100%' id='issue_benchmark_spread' name='issue_benchmark_spread[]' value='" .$row['issue_benchmark_spread']. "'>";?>
    </td>
    </tr>
    <tr>
    <td align="left">Issue Price</td>
    <td>
    <?php echo "<input type='Text' width='100%' id='issue_price' name='issue_price[]' value='" .$row['issue_price']. "'>";?>
    </td>
    </tr>
    <tr>
    <td align="left">Coupon Step</td>
    <td>
    <?php echo "<input type='Text' width='100%' id='coupon_step' name='coupon_step[]' value='" .$row['coupon_step']. "'>";?>
    </td>
    </tr>
    </table>
    </td>

    <td>
    <table width='100%'>
    <tr>
    <td align="left">Announcement Date</td>
    <td>
    <?php echo "<input type='Text' width='100%' id='announcement_date' name='announcement_date[]' value='" .$row['announcement_date']. "'>";?>
    </td>
    </tr>
    <tr>
    <td align="left">Interest Accrual Date</td>
    <td>
    <?php echo "<input type='Text' width='100%' id='interest_accrual_date' name='interest_accrual_date[]' value='" .$row['interest_accrual_date']. "'>";?>
    </td>
    </tr>
    <tr>
    <td align="left">First Settlement Date</td>
    <td>
    <?php echo "<input type='Text' width='100%' id='first_settle_date' name='first_settle_date[]' value='" .$row['first_settle_date']. "'>";?>
    </td>
    </tr>
    <tr>
    <td align="left">First Coupon Date</td>
    <td>
    <?php echo "<input type='Text' width='100%' id='first_coupon_date' name='first_coupon_date[]' value='" .$row['first_coupon_date']. "'>";?>
    </td>
    </tr>
    <tr>
    <td align="left">Maurity Date</td>
    <td>
    <?php echo "<input type='Text' width='100%' id='maturity_date' name='maturity_date[]' value='" .$row['maturity_date']. "'>";?>
    </td>
    </tr>
    <tr>
    <td align="left">Call Date</td>
    <td>
    <?php echo "<input type='Text' width='100%' id='first_call_date' name='first_call_date[]' value='" .$row['first_call_date']. "'>";?>
    </td>
    </tr>
    </table>
    </td>

    <td>
    <table width='100%'>
    <tr>
    <td align="left">Amount Issued</td>
    <td>
    <?php echo "<input type='Text' width='100%' id='amount_issued' name='amount_issued[]' value='" .$row['amount_issued']. "'>";?>
    </td>
    <td></td>
    </tr>
    <tr>
    <td align="left">Amount Outstanding</td>
    <td>
    <?php echo "<input type='Text' width='100%' id='amount_outstanding' name='amount_outstanding[]' value='" .$row['amount_outstanding']. "'>";?>
    </td>
    </tr>
    <tr>
    <td align="left">Minimum Size</td>
    <td>
    <?php echo "<input type='Text' width='100%' id='min_size' name='min_size[]' value='" .$row['min_size']. "'>";?>
    </td>
    </tr>
    <tr>
    <td align="left">Increment</td>
    <td>
    <?php echo "<input type='Text' width='100%' id='increment' name='increment[]' value='" .$row['increment']. "'>";?>
    </td>
    </tr>
    <tr>
    <td align="left">Par Amount</td>
    <td>
    <?php echo "<input type='Text' width='100%' id='par_amount' name='par_amount[]' value='" .$row['par_amount']. "'>";?>
    </td>
    </tr>
    </table>
    </td>

    </tr>



    <?php $irow++;

    }

    $db1->close;

    ?>

    </table>

    </form>
    </body>
    </html>

  4. #4
    Smooth Moperator techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,532

    Re: $_POST problem

    try changing how your ifs are string together:
    php Code:
    1. if (isset($_POST['bonddescription']))
    2. {
    3. include_once('reduced_view_issues.php');
    4. include_once('select_issue.php');
    5. }
    6. elseif (isset($_POST["btnedit"]))
    7. {
    8. include_once('reduced_view_issues.php');
    9. include_once('select_issue2.php');
    10. }
    11. elseif (isset($_POST["btnupdate"]))
    12. {
    13. include_once('reduced_view_issues.php');
    14. include_once('select_issue2.php');
    15. }
    16. elseif (isset($_POST["btncancel"]))
    17. {
    18. include_once('reduced_view_issues.php');
    19. include_once('select_issue.php');
    20. }
    21. elseif (isset($_POST["btndelete"]))

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  5. #5

    Thread Starter
    Lively Member
    Join Date
    May 2004
    Location
    London
    Posts
    107

    Re: $_POST problem

    Hmm, that doesn't appear to work.

    I'm not sure if it will help, but here is the initial page:

    <head>
    <title>Issues- Reduced View</title>
    </head>
    <body marginheight="0" topmargin="0" marginwidth="0"
    leftmargin="0" style="margin:0;padding:0" bgcolor="#B0E0E6">
    <h1></h1>

    <form action="reduced_view_issues.php" method="post">
    <?php

    include_once('functions.php');

    if(is_numeric($_POST['ddsub_sector_id'])) {$subsectorid=$_POST['ddsub_sector_id'];} else {$subsectorid='1';}
    if(empty($_POST['tbtickersearch'])) {$bondticker="'%'";} else {$bondticker="'".$_POST['tbtickersearch']."%'";}
    if(is_numeric($_POST['ddcurrency_id'])) {$currencyid=$_POST['ddcurrency_id'];} else {$currencyid='NULL';}
    if(is_numeric($_POST['ddcountry_id'])) {$countryid=$_POST['ddcountry_id'];} else {$countryid='NULL';}
    if(empty($_POST['tbenterticker'])) {$enterticker='NULL';} else {$enterticker="'".$_POST['tbenterticker']."'";}
    if(empty($_POST['tbenterlevel'])) {$enterlevel='NULL';} else {$enterlevel="'".$_POST['tbenterlevel']."'";}
    if(is_numeric($_POST['ddquote_convention_id'])) {$quoteconventionid=$_POST['ddquote_convention_id'];} else {$quoteconventionid='NULL';}
    if(is_numeric($_POST['ddbenchmark_id'])) {$benchmarkid=$_POST['ddbenchmark_id'];} else {$benchmarkid='NULL';}
    if(empty($_POST['tbentermaturity'])) {$entermaturity='NULL';} else {$entermaturity="'".$_POST['tbentermaturity']."'";}

    $result=get_dataset($server_name, $user_name, $password, $database_name,"call sp_filter_issues_reduced_view(".$subsectorid.",".$bondticker.",".$currencyid.",".$countryid.")");

    ?>

    <table border="0"; style="border-collapse:collapse; border:solid 1px black"; bgcolor='#C0C0C0' width=100%>
    <tr bgcolor='#C0C0C0' width=100%>
    <td align='center'>
    <table style="border-collapse:collapse; border:solid 1px #C0C0C0"; bgcolor='#C0C0C0'>
    <tr bgcolor='#C0C0C0' width=100%>
    <td style="width: auto">
    Select Sub Sector
    <?php simple_drop_down('ddsub_sector_id','sub_sector_id','sub_sector_name',$server_name, $user_name, $password, $database_name,"call sp_sub_sector",0,$subsectorid); ?>
    </td>
    <td >
    </td>
    <td style="width: auto">
    Enter Description
    <?php echo "<input type='text' name='tbtickersearch' value='".$_POST['tbtickersearch']."'/>"; ?>
    </td>
    <td style="width: auto">
    Select Currency
    <?php simple_drop_down('ddcurrency_id','currency_id','currency_ticker',$server_name, $user_name, $password, $database_name,"call sp_currency",1,$currencyid);?>
    </td>
    <td style="width: auto">
    Select Country
    <?php simple_drop_down('ddcountry_id','country_id','country_code',$server_name, $user_name, $password, $database_name,"call sp_country",1,$countryid);?>
    </td>
    <td style="width: auto">
    <input type='submit' name='btnsearch' value='Search' style="width: auto">
    </td>
    </tr>
    </table>
    </td>
    <td align='center'>
    <table style="border-collapse:collapse; border:solid 1px #C0C0C0"; bgcolor='#C0C0C0'>
    <tr bgcolor='#C0C0C0' width=100%>
    <td style="width: auto">
    Enter Description
    <?php echo "<input type='text' name='tbenterticker' value='".$_POST['tbenterticker']."'/>"; ?>
    </td>
    <td style="width: auto">
    Enter Level
    <?php echo "<input type='text' name='tbenterlevel' value='".$_POST['tbenterlevel']."'/>"; ?>
    </td>
    <td style="width: auto">
    Select Quote Convention
    <?php simple_drop_down('ddquote_convention_id','quote_convention_id','quote_convention_name',$server_name, $user_name, $password, $database_name,"call sp_all_quote_convention",1,$quoteconventionid);?>
    </td>
    <td style="width: auto">
    Select Benchmark
    <?php simple_drop_down('ddbenchmark_id','issue_id','description',$server_name, $user_name, $password, $database_name,"call sp_benchmark",1,$benchmarkid);?>
    </td>
    <td style="width: auto">
    Enter Call/Maturity
    <?php echo "<input type='text' name='tbentermaturity' value='".$_POST['tbentermaturity']."'/>"; ?>
    </td>
    <td style="width: auto">
    <input type='submit' name='btncurve' value='View Curve' style="width: auto">
    </td>
    </tr>
    </table>
    </td>
    </tr>
    <tr>
    <table border="1"; style="border-collapse:collapse; border:solid 1px black"; bgcolor='white'>
    <tr bgcolor='#C0C0C0'>
    <td align='center' style="border-collapse:collapse; border:solid 1px black; width: auto";>Description</td>
    <td align='center' style="border-collapse:collapse; border:solid 1px black";>Currency</td>
    <td align='center' style="border-collapse:collapse; border:solid 1px black";>Call Date</td>
    <td align='center' style="border-collapse:collapse; border:solid 1px black";>Maurity Date</td>
    <td align='center' style="border-collapse:collapse; border:solid 1px black";>ISIN</td>
    <td align='center' style="border-collapse:collapse; border:solid 1px black";>Moody</td>
    <td align='center' style="border-collapse:collapse; border:solid 1px black";>Fitch</td>
    <td align='center' style="border-collapse:collapse; border:solid 1px black";>S&P</td>
    <td align='center' style="border-collapse:collapse; border:solid 1px black";>Capital Type</td>
    <td align='center' style="border-collapse:collapse; border:solid 1px black";>Bid ASW</td>
    <td align='center' style="border-collapse:collapse; border:solid 1px black";></td>
    <td align='center' style="border-collapse:collapse; border:solid 1px black";>Ask ASW</td>
    <td align='center' style="border-collapse:collapse; border:solid 1px black";>Bid Sprd</td>
    <td align='center' style="border-collapse:collapse; border:solid 1px black";></td>
    <td align='center' style="border-collapse:collapse; border:solid 1px black";>Ask Sprd</td>
    <td align='center' style="border-collapse:collapse; border:solid 1px black";>Bid Price</td>
    <td align='center' style="border-collapse:collapse; border:solid 1px black";></td>
    <td align='center' style="border-collapse:collapse; border:solid 1px black";>Ask Price</td>
    <td align='center' style="border-collapse:collapse; border:solid 1px black";>Bid YTC</td>
    <td align='center' style="border-collapse:collapse; border:solid 1px black";></td>
    <td align='center' style="border-collapse:collapse; border:solid 1px black";>Ask YTC</td>
    <td align='center' style="border-collapse:collapse; border:solid 1px black";>Bid YTM</td>
    <td align='center' style="border-collapse:collapse; border:solid 1px black";></td>
    <td align='center' style="border-collapse:collapse; border:solid 1px black";>Ask YTM</td>
    <td align='center' style="border-collapse:collapse; border:solid 1px black";>Date</td>
    <td align='center' style="border-collapse:collapse; border:solid 1px black";>Time</td>
    <td align='center' style="border-collapse:collapse; border:solid 1px black";>Source</td>
    <td align='center' style="border-collapse:collapse; border:solid 1px black";>Change on Day</td>
    <td align='center' style="border-collapse:collapse; border:solid 1px black";>Change from Issue</td>
    <td align='center' style="border-collapse:collapse; border:solid 1px black";>Quote Convention</td>
    <td align='center' style="border-collapse:collapse; border:solid 1px black";>Price To</td>
    <td align='center' style="border-collapse:collapse; border:solid 1px black";>Current Benchmark</td>
    <td align='center' style="border-collapse:collapse; border:solid 1px black";>Issue Swap Spread</td>
    <td align='center' style="border-collapse:collapse; border:solid 1px black";>Issue Benchmark Spread</td>
    <td align='center' style="border-collapse:collapse; border:solid 1px black";>Issue Price</td>
    <td align='center' style="border-collapse:collapse; border:solid 1px black";>Coupon Step</td>
    <td align='center' style="border-collapse:collapse; border:solid 1px black";>Amt Issued</td>
    <td align='center' style="border-collapse:collapse; border:solid 1px black";>Amt Outstanding</td>
    </tr>
    <?php

    $irow=0;
    foreach ($result as $row)
    {

    if ($irow % 2 != 0) # An odd row
    $colour = "6699FF";
    else # An even row
    $colour = "white";

    echo "<form action='select_issue3.php' method='post'>";

    if (max($_POST['issueid'])==$row['issue_id'])

    $colour="yellow";

    echo "<tr bgcolor=".$colour.">";
    echo "<td style='white-space: nowrap; width: auto; border-collapse:collapse; border:solid 1px black';>";
    echo "<input type='submit' style='width: auto' id='bonddescription' name='bonddescription[]' value='" .$row['description']. "'><input type='hidden' id='issueid' name='issueid[]' value='".$row['issue_id']."'>";
    echo "</td>";
    ?>
    <td style='white-space: nowrap; border-collapse:collapse; border:solid 1px black';>
    <?php echo $row['currency_ticker'];?>
    </td>
    <td style='white-space: nowrap; border-collapse:collapse; border:solid 1px black';>
    <?php echo $row['first_call_date'];?>
    </td>
    <td style='white-space: nowrap; border-collapse:collapse; border:solid 1px black';>
    <?php echo $row['maturity_date'];?>
    </td>
    <td style='white-space: nowrap; border-collapse:collapse; border:solid 1px black';>
    <?php echo $row['isin'];?>
    </td>
    <td style='white-space: nowrap; border-collapse:collapse; border:solid 1px black';>
    <?php echo $row['moody'];?>
    </td>
    <td style='white-space: nowrap; border-collapse:collapse; border:solid 1px black';>
    <?php echo $row['fitch'];?>
    </td>
    <td style='white-space: nowrap; border-collapse:collapse; border:solid 1px black';>
    <?php echo $row['sandp'];?>
    </td>
    <td style='white-space: nowrap; border-collapse:collapse; border:solid 1px black';>
    <?php echo $row['capital_name'];?>
    </td>
    <td align='right' style='white-space: nowrap; border-collapse:collapse; border:solid 1px black';>
    <?php echo $row['bid_asw'];?>
    </td>
    <td align='center' style='white-space: nowrap; border-collapse:collapse; border:solid 1px black';>
    /
    </td>
    <td align='left' style='white-space: nowrap; border-collapse:collapse; border:solid 1px black';>
    <?php echo $row['ask_asw'];?>
    </td>
    <td align='right' style='white-space: nowrap; border-collapse:collapse; border:solid 1px black';>
    <?php echo $row['bid_sprd'];?>
    </td>
    <td align='center' style='white-space: nowrap; border-collapse:collapse; border:solid 1px black';>
    /
    </td>
    <td align='left' style='white-space: nowrap; border-collapse:collapse; border:solid 1px black';>
    <?php echo $row['ask_sprd'];?>
    </td>
    <td align='right' style='white-space: nowrap; border-collapse:collapse; border:solid 1px black';>
    <?php echo $row['bid_price'];?>
    </td>
    <td align='center' style='white-space: nowrap; border-collapse:collapse; border:solid 1px black';>
    /
    </td>
    <td align='left' style='white-space: nowrap; border-collapse:collapse; border:solid 1px black';>
    <?php echo $row['ask_price'];?>
    </td>
    <td align='right' style='white-space: nowrap; border-collapse:collapse; border:solid 1px black';>
    <?php echo $row['bid_ytc'];?>
    </td>
    <td align='center' style='white-space: nowrap; border-collapse:collapse; border:solid 1px black';>
    /
    </td>
    <td align='left' style='white-space: nowrap; border-collapse:collapse; border:solid 1px black';>
    <?php echo $row['ask_ytc'];?>
    <td align='right' style='white-space: nowrap; border-collapse:collapse; border:solid 1px black';>
    <?php echo $row['bid_ytm'];?>
    </td>
    <td align='center' style='white-space: nowrap; border-collapse:collapse; border:solid 1px black';>
    /
    <td align='left' style='white-space: nowrap; border-collapse:collapse; border:solid 1px black';>
    <?php echo $row['ask_ytm'];?>
    </td>
    <td style='white-space: nowrap; border-collapse:collapse; border:solid 1px black';>
    <?php echo $row['price_date'];?>
    </td>
    <td style='white-space: nowrap; border-collapse:collapse; border:solid 1px black';>
    <?php echo $row['price_time'];?>
    </td>
    <td style='white-space: nowrap; border-collapse:collapse; border:solid 1px black';>
    <?php echo $row['source_code'];?>
    </td>
    <td style='white-space: nowrap; border-collapse:collapse; border:solid 1px black';>
    <?php echo number_format($row['cod'],3);?>
    </td>
    <td style='white-space: nowrap; border-collapse:collapse; border:solid 1px black';>
    <?php echo number_format($row['change_from_issue'],3);?>
    </td>
    <td style='white-space: nowrap; border-collapse:collapse; border:solid 1px black';>
    <?php echo $row['quote_convention_name'];?>
    </td>
    <td style='white-space: nowrap; border-collapse:collapse; border:solid 1px black';>
    <?php echo $row['price_to_name'];?>
    </td>
    <td style='white-space: nowrap; border-collapse:collapse; border:solid 1px black';>
    <?php echo $row['current_benchmark_description'];?>
    </td>
    <td style='white-space: nowrap; border-collapse:collapse; border:solid 1px black';>
    <?php echo $row['issue_swap_spread'];?>
    </td>
    <td style='white-space: nowrap; border-collapse:collapse; border:solid 1px black';>
    <?php echo $row['issue_benchmark_spread'];?>
    </td>
    <td style='white-space: nowrap; border-collapse:collapse; border:solid 1px black';>
    <?php echo $row['issue_price'];?>
    </td>
    <td style='white-space: nowrap; border-collapse:collapse; border:solid 1px black';>
    <?php echo $row['coupon_step'];?>
    </td>
    <td style='white-space: nowrap; border-collapse:collapse; border:solid 1px black';>
    <?php echo $row['amount_issued']/1000000;?>
    </td>
    <td style='white-space: nowrap; border-collapse:collapse; border:solid 1px black';>
    <?php echo $row['amount_outstanding']/1000000;?>
    </td>
    </tr>

    <?php
    echo "</form>";
    $irow++;

    }


    ?>

    </table>
    </tr>
    <tr>
    <td>
    <?php //include_once('select_issue2.php'); ?>
    </td>
    </tr>
    </table>

    </form>
    </body>
    </html>

    I'm just wondering, as this is the common page in all the statements, whether the issue is here somehow...

  6. #6

    Thread Starter
    Lively Member
    Join Date
    May 2004
    Location
    London
    Posts
    107

    Re: $_POST problem

    Got it!

    One of those really frustrating ones that you feel you should have spotted straight away, but a day or two away seems to have done the trick...

    When the bonddescriptiom array gets submitted from the form 'reduced_view_issues.php' it obviously triggers the if statement:

    if (isset($_POST['bonddescription']))

    {include_once('reduced_view_issues.php');
    include_once('select_issue.php');
    }

    Of course what I overlooked was that I also had an array called bonddescription in the form 'select_issue2.php', which was triggering the same if statement, seemingly instead of the expected one (btnupdate or btndelete).

    Presumably this is because bonddescription comes first in the script?

    It works now I've amended the name of the second array, but for my understaning, would the order be the reason why this is likely to have occured?

  7. #7
    Smooth Moperator techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,532

    Re: $_POST problem

    yes... which is why I had suggested changing them to if elseif... but I see now what that still didn't help... because it was checking for that first... so it goes "OK bonddescription is set... run this code..." then later it encounters the if for btndelete and goes "Hey, btndelete is set... run that code too!"

    Just as an FYI - ideally, you want to check your _POST settings all up at the top, and then set variables to contain their values... then use the variables through the rest of the script... makes it a little easier to read and follow throuhg... you can also layout your logic up front, set flags that will determine what needs to be be done... just some thoughts... I have a tendency to want to separate my logic (PHP code) from my display (HTML) and make the HTML as simple as possible... it's just me...

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  8. #8

    Thread Starter
    Lively Member
    Join Date
    May 2004
    Location
    London
    Posts
    107

    Re: $_POST problem

    Yep that makes sense, makes things much neater!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width