473,320 Members | 1,926 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,320 software developers and data experts.

(n00b) One script, multiple transactions

I'm an experienced C/C++ programmer learning PHP.

I'm currently trying to write a simple unit converter script. I thought
I saw a tutorial somewhere that used isset() to determine whether the
script is running for the first time, initialize if so, perform the
usual function otherwise. But my own attempt at this doesn't seem to
work. Every time I hit Submit, my start-up branch runs, variables are
re-initialized, units not converted.

Would someone be so kind as to reply with a script that will, say,
increment a displayed counter every time Submit is clicked? TIA!

--
--
Lynn Wallace http://www.xmission.com/~lawall
"I'm not proud. We really haven't done everything we could to protect
our customers. Our products just aren't engineered for security."
--Microsoft VP in charge of Windows OS Development, Brian Valentine.

Jul 17 '05 #1
4 2324
you need to use self submitting script with a hidden field to submit
everytime you hit submit.

sanjay

"Raptor" <me@attbi.com> wrote in message news:3F************@attbi.com...
| I'm an experienced C/C++ programmer learning PHP.
|
| I'm currently trying to write a simple unit converter script. I thought
| I saw a tutorial somewhere that used isset() to determine whether the
| script is running for the first time, initialize if so, perform the
| usual function otherwise. But my own attempt at this doesn't seem to
| work. Every time I hit Submit, my start-up branch runs, variables are
| re-initialized, units not converted.
|
| Would someone be so kind as to reply with a script that will, say,
| increment a displayed counter every time Submit is clicked? TIA!
|
| --
| --
| Lynn Wallace http://www.xmission.com/~lawall
| "I'm not proud. We really haven't done everything we could to protect
| our customers. Our products just aren't engineered for security."
| --Microsoft VP in charge of Windows OS Development, Brian Valentine.
|
Jul 17 '05 #2
I noticed that Message-ID: <3F************@attbi.com> from Raptor
contained the following:
Would someone be so kind as to reply with a script that will, say,
increment a displayed counter every time Submit is clicked? TIA!


<html>
<head>
<title>Counter</title>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<?php
if (!$_POST["submit"]){
$counter=0;
}
else{$counter=$_SERVER['QUERY_STRING']+1;
}
?>
<form name="form1" method="post" action="<?php
print"$PHP_SELF?$counter"?>">
<p>Counter = <?php print $counter; ?>
</p>
<p>
<input type="submit" name="submit" value="Submit">
</p>
</form>
</body>
</html>

--
Geoff Berrow
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Jul 17 '05 #3
Geoff Berrow wrote:
I noticed that Message-ID: <3F************@attbi.com> from Raptor
contained the following:

Would someone be so kind as to reply with a script that will, say,
increment a displayed counter every time Submit is clicked? TIA!

<html>
<head>
<title>Counter</title>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<?php
if (!$_POST["submit"]){
$counter=0;
}
else{$counter=$_SERVER['QUERY_STRING']+1;
}
?>
<form name="form1" method="post" action="<?php
print"$PHP_SELF?$counter"?>">
<p>Counter = <?php print $counter; ?>
</p>
<p>
<input type="submit" name="submit" value="Submit">
</p>
</form>
</body>
</html>


Thanks, Geoff!

When I copied/pasted into increment.html, it didn't work worth squat.
Changing the name to increment.php works like a charm. Sigh, I thought
Linux systems ignored filename extensions. Is this some HTTP thing?
(Can you tell I've been programming well below the web level for most of
my career?:-)

--
--
Lynn Wallace http://www.xmission.com/~lawall
"I'm not proud. We really haven't done everything we could to protect
our customers. Our products just aren't engineered for security."
--Microsoft VP in charge of Windows OS Development, Brian Valentine.

Jul 17 '05 #4
Linux doesn't really care about file extensions that much, but webservers
does.. :p

--
// DvDmanDT
MSN: dv******@hotmail.com
Mail: dv******@telia.com
"Raptor" <me@attbi.com> skrev i meddelandet news:3F************@attbi.com...
Geoff Berrow wrote:
I noticed that Message-ID: <3F************@attbi.com> from Raptor
contained the following:

Would someone be so kind as to reply with a script that will, say,
increment a displayed counter every time Submit is clicked? TIA!

<html>
<head>
<title>Counter</title>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<?php
if (!$_POST["submit"]){
$counter=0;
}
else{$counter=$_SERVER['QUERY_STRING']+1;
}
?>
<form name="form1" method="post" action="<?php
print"$PHP_SELF?$counter"?>">
<p>Counter = <?php print $counter; ?>
</p>
<p>
<input type="submit" name="submit" value="Submit">
</p>
</form>
</body>
</html>


Thanks, Geoff!

When I copied/pasted into increment.html, it didn't work worth squat.
Changing the name to increment.php works like a charm. Sigh, I thought
Linux systems ignored filename extensions. Is this some HTTP thing?
(Can you tell I've been programming well below the web level for most of
my career?:-)

--
--
Lynn Wallace http://www.xmission.com/~lawall
"I'm not proud. We really haven't done everything we could to protect
our customers. Our products just aren't engineered for security."
--Microsoft VP in charge of Windows OS Development, Brian Valentine.

Jul 17 '05 #5

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

Similar topics

15
by: Arnaud | last post by:
Hi, I have a script which inserts some rows in an InnoDB table. I want to be sure that all the rows are inserted, so i use a mysql transaction ("start transaction", insertions, and "commit"). ...
11
by: Alban Hertroys | last post by:
Oh no! It's me and transactions again :) I'm not really sure whether this is a limitation of psycopg or postgresql. When I use multiple cursors in a transaction, the records inserted at the...
2
by: gabriel | last post by:
Greetings, I am adding foreign keys to a database and saving the generated scripts. What I do not understand is that all script begin with empty transactions. Why ? Example follows : /*
12
by: Berj | last post by:
i have a novice question. is Access multi-user? can multiple users access the same database?
0
by: MHenry | last post by:
Hi, I know virtually nothing about creating Macros in Access. I would appreciate some help in creating a Macro or Macros that automatically run(s) 14 Queries (three Make Table Queries, and 11...
6
by: Ted | last post by:
Hello all, Please could somebody with a little time on their hands help me with my net sockets program? The aim is to send multiple transactions via C# network stream and read them back. The...
13
by: Robin Haswell | last post by:
Hey people I'm an experience PHP programmer who's been writing python for a couple of weeks now. I'm writing quite a large application which I've decided to break down in to lots of modules...
1
by: Roobmeister | last post by:
I have a script that builds multiple tables and then builds tables from those tables, etc.. Usually, I run the script as a DTS package, and it doesn't have any problems. However, when I save the...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
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...
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...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
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...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work

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.