Hi all,
I have a form with a field called ReportID in aspx on our local Intranet. Everytime this report is loaded into a browser, I need the ReportID field to be incremented by one. I got this to work with Javascript except when the page was closed and reloaded, the ReportID field was set back to one instead of storing the new number and incrementing from there.
I was told that writing a PHP script and storing the incremented number in a file or db would be my best option.
Can someone please let me know where I need to start in order to do this?
Thanks.
5 1387 Markus 6,050
Recognized Expert Expert
Are you able to use a database? Such as MySQL?
If so, there are many, many tutorials out there - and from what i read you're needs are pretty basic.
Are you able to use a database? Such as MySQL?
If so, there are many, many tutorials out there - and from what i read you're needs are pretty basic.
I would be able to use SQL Server but would prefer just using a flat file if possible. I don't want to clutter up our SQL server db with just one column for storing numbers. Is that possible?
Markus 6,050
Recognized Expert Expert
I would be able to use SQL Server but would prefer just using a flat file if possible. I don't want to clutter up our SQL server db with just one column for storing numbers. Is that possible?
Sure it's possible!
Have a look at tizag.com's file tutorials
When you've had a play around, come back and we'll help you from there :)
Sure it's possible!
Have a look at tizag.com's file tutorials
When you've had a play around, come back and we'll help you from there :)
Thanks for the tutorial and now for my questions. :-)
Here is what I have for code:
[PHP]
$ourFileName = "reportid.t xt";
$fh = fopen($ourFileN ame, 'r') or die("Can't open file");
$theData = fgets($fh);
fclose($fh);
echo $theData;
[/PHP]
I have created a file called ReportID.txt and typed a list of numbers in it: i.e. 1000
1001
1002...etc.
First question: Where do I put this code on my page so that the value that is read into the script (for ex: 1000) displays in my ReportID text box? I understand that echo means display what's in the text file but I want it to put that value in my text box on my page.
Second question: Does the script know to read the next line of the ReportID.txt file when the page is loaded again or do I need to use Append+ (a+) instead of Read (r)? **update (I answered this question myself, so ignore it** :-)
Thanks!
If you mean by text box, an input text field (and not an input drop down box) something like[php]echo "<input type='text' name='txtname' value='$theData ' />";[/php]will do.
Ronald
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: mjkahn |
last post by:
I've read (and read!) that you shouldn't store objects in Session variables.
I've read these reasons:
- The object takes up memory that may not be freed until the session times
out. Better to create the object only when you actually use it.
- Causes poor performance because the thread that created the object has to
service all requests for it.
Assuming I can live with the memory and performance implications (a big if,
|
by: Alfonso Morra |
last post by:
I have written the following code, to test the concept of storing
objects in a vector. I encounter two run time errors:
1). myClass gets destructed when pushed onto the vector
2). Prog throws a "SEGV" when run (presumably - attempt to delete
deleted memory.
Please take a look and see if you can notice any mistakes I'm making.
Basically, I want to store classes of my objects in a vector. I also
have three further questions:
|
by: Kay |
last post by:
A linked list is storing several names. I want to make a queue if I
input a name that is same as the linked list. How to make each node of a
linked list storing a queue that are different with each other node, do
I need to add one more item in the ListNode OR I only call the queue
insert function to do it ?
|
by: Phil Latio |
last post by:
I have 2 virtually identical tables and wish to move data between them.
Basically one table is called "live_table" and the other is named
"suspended_table" and the only difference is that the primary key in the
"suspended_table" is an auto incremented integer where as "live_table"
primary key is just a standard integer.
Here's the life-cycle:
1. Record gets entered into "suspended_table"
2. Record checked and then inserted into...
|
by: mike |
last post by:
I have a datagridview control and a button on the windows form. I am
adding a new row in button click event. When the number of rows grow,
the newly added row will not be
visible but a scroll bar will be shown.
I want the program to highlight the newly added row and make it visible
in the datagridview by scrolling to that position when a new row was
added by button click event. How can you do that? Thanks in advance.
| |
by: A. Farber |
last post by:
Hello,
I'm programming a web game on OpenBSD, but am
also trying to keep in runnable on Linux and Cygwin.
I have a list of tables at which a player/kibitzer can
sit down or create a new empty one if (s)he wants.
I keep tables in a doubly-linked list using the nice TAILQ_* macros:
http://www.openbsd.org/cgi-bin/man.cgi?query=queue
|
by: Chris B |
last post by:
Howdy,
When the AddNew button is clicked on the BindingNavigator, a new row is made in the datagrid and the row selector moves to that newly created row, what is the method that moves the selector to the new row? I have created a method that calls the AddNew method on a DefaultView and creates a new row. I need to move to that newly created row and get the value from a auto-incremented cell in the new row and then populate a combo box with...
|
by: paragthakur |
last post by:
Hi All...
I m developing a collection record module.
In which the invoice number field should be auto incremented....
My problem is :"How can i access the current+1 invoice number in new form entry which is to be filled"...
Pls help me with u r solutions....
|
by: jalley06 |
last post by:
Hi,
I have a form on our internal intranet that has a field called Report ID. When the user clicks the print button, this number increments by one. The problem is, the newly incremented number is not stored for the next time the web page is loaded. It defaults back to 111 (which is what I currently have it set to). I'm using Sharepoint Designer 2007 but my increment function is in Javascript.
Can someone help me and let me know what I...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |