You are here: Best approach to run queries only when user chooses « PHP Programming Language « IT news, forums, messages
Best approach to run queries only when user chooses

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]


УдалСнная Ρ€Π°Π±ΠΎΡ‚Π° для программистов  •  Как Π·Π°Ρ€Π°Π±ΠΎΡ‚Π°Ρ‚ΡŒ Π½Π° Google AdSense  •  England, UK  •  ΡΡ‚Π°Ρ‚ΡŒΠΈ Π½Π° английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Π‘Π°ΠΉΡ‚ ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ Π² Π‘Ρ‚ΡƒΠ΄ΠΈΠΈ Π’Π°Π»Π΅Π½Ρ‚ΠΈΠ½Π° ΠŸΠ΅Ρ‚Ρ€ΡƒΡ‡Π΅ΠΊΠ°
ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ΠΈΠ΅ ΠΈ ΠΏΠΎΠ΄Π΄Π΅Ρ€ΠΆΠΊΠ° Π²Π΅Π±-сайтов, Ρ€Π°Π·Ρ€Π°Π±ΠΎΡ‚ΠΊΠ° ΠΏΡ€ΠΎΠ³Ρ€Π°ΠΌΠΌΠ½ΠΎΠ³ΠΎ обСспСчСния, поисковая оптимизация