Hey, as usual I have a question that may get laughed at by the brains that frequent this board... My story is this: I have a form on a clients website that is used to collect email addresses. It is a simple form with a PHP page that sends an e-mail to the clients address and signs the user up for the mailing list. It works great. They want to be able to have a Laptop running offline do the same thing (well almost the same).
I created the HTML and form and all the easy stuff and I thought that I could simply host my PHP on the hard drive (ie. target="C:\signedup.php") then change the code to save a file somewhere (like in a given notepad file). Everything was great until I actually tried to do it. With my very limited knowledge of this sort of thing I quickly found myself lost beyond belief; as usual when I find myself in those situations I come running here! Please help! I am getting desperate. I would love to learn something new! Thanks in advance. -Linus
does the laptop actually have a php interpreter? For that matter, to activate the form from a web browser, you'd need to be running a web server on the laptop. I've used PHP commend-line scripts independant of a browser, but if you want them to be called from a browser, you need a web server.
Once you have that, you can just change the form to have 'action="http://localhost/form-processor.php"'. Exactly where on the hard drive that is will depend on where the web root for your web server is.
Doing something like this for a stand-alone laptop seems excessive. I certainly wouldn't want to run a web server on my laptop. Are you sure they wouldn't be just as well off with a quickie program in VB/Python/Perl to take the data and write it to a file for them? Possibly even just a spreadsheet with the column names labeled, and processing the data later by exporting to a CSV file or such?
"Doing something like this for a stand-alone laptop seems excessive."
Hey now, I do virtually all of my development on my laptop. It is nice to be able to show clients exactly hwat things look like and how they work in an offline environment (where "borrowing" the code/markup is never an issue).
Oh, if the laptop is a development machine, it makes *perfect* sense - I wouldn't have a development machine *without* Apache+PHP. But if I were developing an app with the intent to use it on a non-networked machine, I wouldn't bother with the overhead of running a web server and generating HTML for a browser instead of, say, linking against GTK+ (or Qt, or whatever Windows people use) to provide an interface.
Well doing a spreadsheet was actually my first suggestion but they really want the look of a website and the interactivity of a website. This will not be merely a "sign yourself up for a newsletter" form, it is more like a website with some exclusive content and a mailing list signup option.
"Are you sure they wouldn't be just as well off with a quickie program in VB/Python/Perl to take the data and write it to a file for them? " - Can any of that be run via HTML in a browser?
I was thinking there may be an extremely simple way of getting around this...maybe something with the form action only? Could I do a method="get" then somehow use hidden values to write a file with the input information? I didn't know what I was getting into here...
Oh yeah and the laptop they are using has win98 and it doesn't look like it has anything too fancy on it, but I have been given limited permission to install neccasary things. Thanks for the responses! I'll keep working on it...does anyone know where else I could look for something like this?
If you need help setting up the web server then I'd suggest going to HotScripts and looking up Installation Kits. I've personally used the firepages one on a win98 machine with no problems. It even sets up mySQL but using that seems a bit much for what you're storing. If you want to write to a file then look at the "fopen" (in append mode) and "fwrite" functions on php.net.