Forms confusion (total noobie)

I’ve never done a form before, but I need to get one up this weekend. It was recommended from someone on this forum that I use easibase. But the server that hosts the site does not support ioncube. So, I need to figure something else out.

Ideally, the owner of the site would like all the info to be downloadable into an excel file. But, she will deal with individual emails if need be.

I was talking this over w/ the ISP and she sent me an email that sounds helpful, but is way over my head. She said she added a cgibin folder that has the script I needed to run the email from. She said she put the form in and hooked it all up, but I needed to go to the mail area and either forward the mail to me or set it up to dump into another email account.

I have no clue what to do now. Can someone please help me figure this out? Should I try to work with the files I don’t understand in the cgibin folder? Or is there another option that will work with freeway that perhaps this ISP will support?

Thank you in advance!
Doty

Tim Plumb has the excellent PHP Feedback Form action FreewayActions.com | PHP feedback form

David


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

You could try the PHP Feedback Form action for the mail side, I am not sure how you can get it into an Excel doc but simply copying the email text and pasting * should * place the data on the same lines as it came in the email… although it will not be automatically placed in columns and cells you might find this method to be fine.

HTH

On May 17, 2008, at 5:44 PM, Doty Shepard wrote:

I’ve never done a form before, but I need to get one up this weekend. It was recommended from someone on this forum that I use easibase. But the server that hosts the site does not support ioncube. So, I need to figure something else out.

Ideally, the owner of the site would like all the info to be downloadable into an excel file. But, she will deal with individual emails if need be.

I was talking this over w/ the ISP and she sent me an email that sounds helpful, but is way over my head. She said she added a cgibin folder that has the script I needed to run the email from. She said she put the form in and hooked it all up, but I needed to go to the mail area and either forward the mail to me or set it up to dump into another email account.

I have no clue what to do now. Can someone please help me figure this out? Should I try to work with the files I don’t understand in the cgibin folder? Or is there another option that will work with freeway that perhaps this ISP will support?

Thank you in advance!
Doty


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

BTW this will get you up and running this W/E but will not solve your Excel issue.

If you want to create a file that can subsequently be output in Excel format I think you are going to have to submit the form to a MySql Database and then deal with it from there.

In the meantime Tim’s action will get youi started.

David


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Hi Doty – I suppose it depends on just how complicated your form needs to be. I’ve used the PHP Feedback Form for many years, if your form requirements are fairly simple – essentially it emails the form contents to whatever mail address you specify. A couple years ago I started using Forms to Go (PHP version) and can create quite complicated forms, though it’s probably pretty complicated for a forms newbie. :slight_smile:

Either solution requires the hosting server to support PHP.

On Sat, May 17, 2008 at 8:44 AM, Doty Shepard wrote:

I have no clue what to do now. Can someone please help me figure this out? Should I try to work with the files I don’t understand in the cgibin folder? Or is there another option that will work with freeway that perhaps this ISP will support?


Ernie Simpson – Freeway 5 Pro User – http://www.thebigerns.com/freeway/

Ok, I’ll dig into Tim’s action and see what I can learn.

Should I do anything with the cgibin folder the ISP created and the files she put in there? Or should I just ignore those??

Thanks.
Doty


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

If you are using the PHP Feedback form action then ignore them.

Mike

On May 17, 2008, at 9:32 PM, Doty wrote:

Ok, I’ll dig into Tim’s action and see what I can learn.

Should I do anything with the cgibin folder the ISP created and the
files she put in there? Or should I just ignore those??


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

There is a way to do this where you create a text file on the server,
and then add each form submission to it as a new line. At any point,
you can simply download the text file and open it in Excel.

Does that sound like something that your client could work with?

Walter

On May 17, 2008, at 11:44 AM, Doty Shepard wrote:

Ideally, the owner of the site would like all the info to be
downloadable into an excel file. But, she will deal with individual
emails if need be.


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Yes. Possibly. How hard is it to set something like this up?

This is a website for a seminar that could have several hundred in
attendence. The form is a registration form for the event. It would be nice
if she didn’t need to deal with several hundred individual emails.

Doty

From: Walter Lee Davis email@hidden
Reply-To: “email@hidden” email@hidden
Date: Sat, 17 May 2008 16:08:09 -0400
To: “email@hidden” email@hidden
Subject: Re: Forms confusion (total noobie)

Does that sound like something that your client could work with?


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Here’s a little lump of code to paste into your form page.

http://pastie.caboo.se/199089

To use this, change your form page’s filename to have the .php file
extension. Paste this code into the Before HTML portion of the Page >
HTML Markup dialog on the form page.

Using an FTP application, move into your Web root folder, alongside
the form page, then move up two levels in the directory structure.
For example, if your form page is here:

/homes/yourname/htdocs/www/yourform.php

then move into the folder

/homes/yourname/

Create a new folder called data in that folder. With the folder
selected, use your FTP application to change the permissions on it to
world -everything: 777. Now, your Web server can create and write to
files within that folder. Because the file is outside of the Web
root, this is not a security problem from the outside world.
(Depending on how your server is configured, this is a security risk
from other users on the same server, but you would need to discuss
that with your hosting provider.)

If for some reason your server does not allow you to move two levels
above the form page, let me know and I will adjust the script
accordingly.

Set your form page to POST to itself, and be sure to use whatever
form validation you want to have using one of the validation Actions.
This script does not perform any validation.

Also be sure to set your form’s submit button so that it has the name
‘save’. It can say anything you like on the button (that’s the
button’s value, not its name) but it must be named save for the code
above to do anything at all. You make these changes on the right-most
tab of the Inspector while the button is selected.

Now, when the form is submitted, a text file called data.csv is
either opened or created inside the data folder, and the form
contents are written to it as a new line at the end of the file. Your
client can download this file using FTP, and open it in Excel. Excel
will notice that it’s a CSV file and convert it to a spreadsheet for
viewing.

At any point, you can simply delete that file from the server, and
the next submission will create a new one. In this way you can start
fresh, perhaps if there is a new seminar offering.

Walter

On May 18, 2008, at 1:09 AM, Doty Shepard wrote:

Yes. Possibly. How hard is it to set something like this up?

This is a website for a seminar that could have several hundred in
attendence. The form is a registration form for the event. It would
be nice
if she didn’t need to deal with several hundred individual emails.

Doty

From: Walter Lee Davis email@hidden
Reply-To: “email@hidden” email@hidden
Date: Sat, 17 May 2008 16:08:09 -0400
To: “email@hidden” email@hidden
Subject: Re: Forms confusion (total noobie)

Does that sound like something that your client could work with?


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Hi Walter - this interesested me so I thought I would give it a try but I got the following errors:

Warning: fopen(/home/deltanet/public_html/data/data.csv) [function.fopen]: failed to open stream: No such file or directory in /home/deltanet/public_html/test/savetest.php on line 4

Warning: fwrite(): supplied argument is not a valid stream resource in /home/deltanet/public_html/test/savetest.php on line 8

Warning: Cannot modify header information - headers already sent by (output started at /home/deltanet/public_html/test/savetest.php:4) in /home/deltanet/public_html/test/savetest.php on line 9

My ‘data’ folder is at

www.deltadzine.net/data

while my form page is at: www.deltadzine.net/public_html/test/savetest.php

which is 2 levels up?

But looking at the first error it appears that it is looking for the ‘data’ folder only one level up.

What am I doing wrong?

David


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

I used Tim’s action and it takes me to a “success” page after I click submit. But I’ve not received an email yet. I thought these were going to be sent to me via email. Am I missing something? Do I just need to wait longer for the email to come in?

Walter, I’ve not yet tried any of your suggestions. At this point, I’m just trying to get the basic form setup. Thanks! I look forward to trying it!

Here’s the page where the form is:

http://www.roxannerenee.com/register.html

Thanks Everyone!
Doty


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

You are putting the data folder inside the web root. That is the
problem. You should not be making a world-writeable folder inside
your public web root where people can get to it. Anyone can download
your data file if they know or guess the URL.

So if your web root folder is /home/deltanet/public_html, then you
are not going to be able to create a folder two levels up, unless you
are root. Simply modify the line of my script that has dirname(dirname
(FILE)) to be dirname(FILE) and put your data folder here:
home/deltanet/data.

This folder is not available from the web, and is thus more secure
from casual snooping.

Walter

On May 18, 2008, at 8:15 PM, DeltaDave wrote:

Hi Walter - this interesested me so I thought I would give it a try
but I got the following errors:

Warning: fopen(/home/deltanet/public_html/data/data.csv)  

[function.fopen]: failed to open stream: No such file or directory
in /home/deltanet/public_html/test/savetest.php on line 4

Warning: fwrite(): supplied argument is not a valid stream  

resource in /home/deltanet/public_html/test/savetest.php on line 8

Warning: Cannot modify header information - headers already  

sent by (output started at /home/deltanet/public_html/test/
savetest.php:4) in /home/deltanet/public_html/test/savetest.php on
line 9

My ‘data’ folder is at

www.deltadzine.net/data

while my form page is at: www.deltadzine.net/public_html/test/
savetest.php

which is 2 levels up?

But looking at the first error it appears that it is looking for
the ‘data’ folder only one level up.

What am I doing wrong?

David


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Hi Walter

That was my error in how I represented the position of the data folder.

I had actually copied the path from transmit which was: ftp://www.deltadzine.net:21//data

Which I then rationalised down to: www.deltadzine.net/data

Which is not actually correct and is really: home/deltanet/data

  • Which is at the same level as my public_html folder.

However I moved the test file I am using to: www.deltadzine.net/public_html/savetest.php (which is I believe one level down from the ‘data’ folder) and changed the script as you suggested to: dirname(FILE)

But still I am getting the errors:

Warning: fopen(./data/data.csv) [function.fopen]: failed to open stream: No such file or directory in /home/deltanet/public_html/savetest.php on line 4

Warning: fwrite(): supplied argument is not a valid stream resource in /home/deltanet/public_html/savetest.php on line 8

Warning: Cannot modify header information - headers already sent by (output started at /home/deltanet/public_html/savetest.php:4) in /home/deltanet/public_html/savetest.php on line 9

Am I just being very thick here?

David


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Hi Doty

I assume that you put an email recipient in the action pane and didn’t just leave it as the default of me (at) mydomain.com

David


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Just tried it - It would also be helpful if you have text on your ‘success’ page something like

"Thank you for your registration information we will be in touch blah, blah, blah

I know you are just trying to get it all to work just now and this will come later.

David


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

On 19 May 2008, 8:54 pm, DeltaDave wrote:

Warning: fopen(./data/data.csv) [function.fopen]: failed to open stream: No such file or directory in /home/deltanet/public_html/savetest.php on line 4

Roll the script back to what I had initially.

$txt = dirname(dirname(__FILE__)) . '/data/data.csv';
$fp = fopen($txt,'a');

I realize now that this traversal is really only going to end up being to one folder up and over, even though there are two dirname() calls in there. That’s because we are going up one level to select ‘public_html’, then up one more level to select ‘deltanet’, and then adding ‘data’ to the path. So if ‘public_html’ and ‘data’ are in the same folder (‘deltanet’) then the final path will be correct.

But the error message here means that you may have tried to do this:

$fp = fopen('./data/data.csv');

This would be fine if you were trying to open the file inside a data folder inside the current directory.

If you wanted to try this, but to access a folder next to the parent of the current folder, you would do this:

$fp = fopen('../data/data.csv');

Some servers do not allow you to use relative notation when opening a file with fopen. The root-relative notation (which is what dirname() returns) always works, in my experience.

In all cases, the folder ‘data’ MUST be set to permissions 777. If you already created data.csv, then it must be set to permissions 666. Or delete it, because the command fopen will create it, with the correct permissions and ownership, if it doesn’t already exist.

There’s a slight chance (depending on how your server is set up) that the resulting file data.csv might not be downloadable by your user through FTP. This is extremely rare, but if you are able to save the data but not download the data file later, let me know and I will give you the two-line answer.

Walter


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Hi Walter

OK thats great - It is writing the file now, and redirecting fine.

But it appears that it is not writing the info to a fresh line every time - it should shouldn’t it?

David


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

That’s what fopen with ‘a’ is supposed to do – append the data to the end of the file. I would expect it would add a newline after each write. What result are you seeing, and in what application?

Walter


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

One change to fix this:

	$line = '"' . implode('","', $form) . ""n";

I am manually adding the newline at the end of the line.

I just tested this with Numbers, haven’t tried it with Excel yet.

Walter


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options