Posted by Ian Davies on 10/24/05 16:58
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 PurchaseQuestions(){
various INSERT INTO queries here
<h1>Confirmation</h1><br>
<p><a href="logout.php"> 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
PurchaseQuestions() function
?>
<h1>Order Status</h1>
<p>You have requested <?php echo $QuestSel; ?> questions at a total cost
of <strong>£<?php echo $QuestSel*.8; ?></strong>
If you wish to proceed with the transaction click <a href=<?php echo
PurchaseQuestions() ?>> Continue</a>.<br>
<?php
}
?>
<?php
mysql_close($conn);
?>
Navigation:
[Reply to this message]
|