473,245 Members | 1,519 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,245 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 2320
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...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
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
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...

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.