Hello
I am trying to run a few INSERT queries only if the user clicks 'continue'
in a <a href> The queries takes variables created from SELECT queries. I
have tried to acheive this by putting The INSERT queries into a function at
the top of my php file and having the SELECT queries below it. I have a
message that pops up that includes a link to the function but I cant get
this to work and am not sure of the best approach. Can anyone help?
My striped down code is below. Im not even sure if you can just use a
function to contain code that doesnt return a value. Mine just runs some
INSERT INTO queries
*************** *************** *************** *************** *******
<?php
function PurchaseQuestio ns(){
various INSERT INTO queries here
<h1>Confirmatio n</h1><br>
<p><a href="logout.ph p"> Logout</a> or return to <a href="Questions .php">
Questions Database</a></p><br><br><br>
Congratulations <b><?php echo $_SESSION[username] ?></b>, your order has
been completed.</p>
<?php
}
?>
<?php
$OrderDate = date('d/m/Y');
Three SELECT queries here which provides variables for the
PurchaseQuestio ns() function
?>
<h1>Order Status</h1>
<p>You have requested <?php echo $QuestSel; ?> questions at a total cost
of <strong>£<?ph p echo $QuestSel*.8; ?></strong>
If you wish to proceed with the transaction click <a href=<?php echo
PurchaseQuestio ns() ?>> Continue</a>.<br>
<?php
}
?>
<?php
mysql_close($co nn);
?>
I am trying to run a few INSERT queries only if the user clicks 'continue'
in a <a href> The queries takes variables created from SELECT queries. I
have tried to acheive this by putting The INSERT queries into a function at
the top of my php file and having the SELECT queries below it. I have a
message that pops up that includes a link to the function but I cant get
this to work and am not sure of the best approach. Can anyone help?
My striped down code is below. Im not even sure if you can just use a
function to contain code that doesnt return a value. Mine just runs some
INSERT INTO queries
*************** *************** *************** *************** *******
<?php
function PurchaseQuestio ns(){
various INSERT INTO queries here
<h1>Confirmatio n</h1><br>
<p><a href="logout.ph p"> Logout</a> or return to <a href="Questions .php">
Questions Database</a></p><br><br><br>
Congratulations <b><?php echo $_SESSION[username] ?></b>, your order has
been completed.</p>
<?php
}
?>
<?php
$OrderDate = date('d/m/Y');
Three SELECT queries here which provides variables for the
PurchaseQuestio ns() function
?>
<h1>Order Status</h1>
<p>You have requested <?php echo $QuestSel; ?> questions at a total cost
of <strong>£<?ph p echo $QuestSel*.8; ?></strong>
If you wish to proceed with the transaction click <a href=<?php echo
PurchaseQuestio ns() ?>> Continue</a>.<br>
<?php
}
?>
<?php
mysql_close($co nn);
?>
Comment