473,324 Members | 2,313 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

PHP problem with executing... if (isset ($_POST['submit']))

csj
I'm having a problem with my PHP script.

When the user arrives on my page there is an item for sale for them to
buy.
The user already has 200 points stored in their database row. I want
it work so that when the user clicks on the "buy" button(only then)
an mysql query is executed to update there points.

I thought of using an "if (isset ($_POST['submit'])) {...."
script, but I don't know what to make the else part of the statement +
I can't get it to work.

If anybody knows what I'm talking about then please help me. Can I
user the If statement or is there something better/easier to use?

Thanks
http://eye.cc php newsgroups
Feb 21 '06 #1
1 25609
csj wrote:
I'm having a problem with my PHP script.

When the user arrives on my page there is an item for sale for them to
buy.
The user already has 200 points stored in their database row. I want
it work so that when the user clicks on the "buy" button(only then)
an mysql query is executed to update there points.

I thought of using an "if (isset ($_POST['submit'])) {...."
script, but I don't know what to make the else part of the statement +
I can't get it to work.

If anybody knows what I'm talking about then please help me. Can I
user the If statement or is there something better/easier to use?

Thanks
http://eye.cc php newsgroups

I use a "hidden" variable that only gets set at submit time

<html><body>
<?php

if (isset($_POST['flag'])) {
echo $_POST['in_name'] ."<br>";
echo '<form method=post><br><center>";
echo '<input TYPE=submit value=Back></center>';
echo '</form>';
// do a bunch of other stuff

}else {
?>
<form method="post">
Enter a NAME:
<input type="text" name="in_name" size="90" />
<input type=hidden name=flag value=1>
<input TYPE=submit value=Submit>
<input TYPE=reset value=Reset>
</form>
<?php
}
?>
</body></html>

--
Michael Austin.
DBA Consultant
Donations welcomed. Http://www.firstdbasource.com/donations.html
:)
Feb 21 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Micke | last post by:
I have problems with this simple program below. It starts to read and dump wav data to file but stops after 2MB. The cdda2wav processes are still alive but nothing more is happening. I have more...
1
by: Job Lot | last post by:
I have written 6 Queries in an Access DB, which are executed in a For Each…Next loop to populate DataSet object. A new DataTable object is created in DataSet for each query, as follows Private...
1
by: T Jones | last post by:
Hello everybody! I hope someone can give hint on this, I'm very confused right now. Our program runs on a DB2-AS/400-System, we're connecting via an EasyCom-IDAPI-BDE (Borland Database...
0
by: simon | last post by:
I have dataGrid on my page with edit button. When user click edit button and change some value and after that click update button, the following code is executed: oCmd = New...
2
by: Ryan Ternier | last post by:
I'm having an issue with this. I have 2 SQL files over 3000 lines long each. I need to run these files when one of our sales people presses a button. I can't save them as a Stored Procedure...
5
by: Full Name | last post by:
The question is not about writing javascript, but having it execute in a browser (IE, firefox or opera, doesn't matter). Since the last series of updates in win2K, javascript no longer executes. ...
1
by: Mike Gaskins | last post by:
I'm working on a web-based mail quarantine management system, and am running into some problems getting it to run the command to release a message. The main exertp of the script is below: ...
8
by: Daz | last post by:
Hi everyone. I was faced with the choice of whether my problem is indeed a PHP problem or a MySQL. I have decided it's a PHP problem as I don't experience the same problem when I execute the...
2
ilikesuresh
by: ilikesuresh | last post by:
Hi all, I have written athe following program to execute a procedure number of times using korn shell scripting for number in `cat $INPUT_FILE` do $SQLPLUS -S...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.