Jump to content
neville

sending forms by email

Recommended Posts

HiI've designed a form that sends email to me, ie. method="post" enctype="text/plain" when user clicks on submit.What I would like to do is after 'submit' is to1) Close the form window2) Re-direct to 'thank you' page3) send data so that it can be inserted into Excel on my desktopI'm an absolute beginner so need to know where to place script, etc.Neville

Share this post


Link to post
Share on other sites

in the form window (assuming this is a seperate window that gets opened form the main window?)put this code

<form .... onsubmit="opener.location = 'redirect url you want';window.close();".....>

Share this post


Link to post
Share on other sites
in the form window (assuming this is a seperate window that gets opened form the main window?)put this code
<form .... onsubmit="opener.location = 'redirect url you want';window.close();".....>

Hi aspnetguythanks for quick response. I've inserted <form name=“registration” onsubmit="opener.location = 'http://my domain/thank_you';window.close();".....>but it does not work. What am I omitting?Also how can I get the data into Excel?RegardsNeville

Share this post


Link to post
Share on other sites

About getting the data into excel:All you have to do is format the data you want in this formfield1, field2, field3, etc.And then you can import that directly into excel where field1 will go into column 1, field2 will go to column2, and so on.

Share this post


Link to post
Share on other sites

do thismain.html

<html><head>	<title>Main Page</title></head><body><a href="form1.html" onclick="window.open(this.href);return false;">Open Form</a></body></html>

form1.html

<html><head>	<title>Form 1</title></head><body><form action="test_process.html" method="post" onsubmit="opener.window.location='http://www.google.com';window.close()"><input type="submit" value="Submit"/></form></body></html>

Share this post


Link to post
Share on other sites

I actually had a script to create a file to import into excel and so I figured I would put it on here for you. I am sure you can modify it to your needs. Right now it goes into a PHP database, retrieves some fields and then places them into a file that can be imported directly into excel.

<?phpmysql_connect("localhost", "user", "passoword");mysql_select_db("users"0;$fp = fopen("./data.csv", "wb");// MySQL Queries$query = "SELECT * FROM Users ordered by Name";$result = mysql_query($query);// Columns$columns = "Name,E-mail,Phone\n";$fwrite($fp, $columns);// MySql Arrayif ($result) {  while ($r = mysql_fetch_array($result)) {    $Name = $r['Name'];    $Email = $r['Email'];    $Phone = $r['Phone'];    // Rows    $data = "$Name,$Email,$Phone\n";    fwrite($fp, $data);  }  echo "A CSV file has been created.";} else {  echo "No data. There may be an error in the database.";}fclose($fp);mysql_free_result($result);?>

Share this post


Link to post
Share on other sites

Hi Nakor & aspnetguyMany thanks for your posts but I think that what I'm trying to do is beyond my capabilities.By the way, my URL for the form is www.nevillescott.co.uk/registration.htmlCheers!Neville

Share this post


Link to post
Share on other sites
Hi Nakor & aspnetguyMany thanks for your posts but I think that what I'm trying to do is beyond my capabilities.By the way, my URL for the form is www.nevillescott.co.uk/registration.htmlCheers!Neville

I understand the frustrations, it's hard to grasp form actions sometimes. But let's try, try again, and never give up (unless you can blame it on IE)You'll need a server-side language (PHP is my preference, ASP, or Cold Fusion also work) to take in the form data. Then you must make a script in your selected language to take in the form data and do something with it. I suggest putting the data in a data base (my data always prefers to hang out in a MySQL database).Then, maybe once a week, you can use a variant of Nakor''s script above to export the data to a file that you can import into Excel. Although, if you're just using the Excel file to keep track of things, you won't need to do that because your database will do it for you.So, step one, determine the type of server you have (Apache and Microsoft IIS are the mos common) and find out if you have a server-side programming language available to use. Check out your web host for information on this, as most paid web hosts will offer either PHP or ASP. Then, do the same to find out if and what kind of database(s) you have available.Get this and let us know and we can help more.

Share this post


Link to post
Share on other sites
I understand the frustrations, it's hard to grasp form actions sometimes. But let's try, try again, and never give up (unless you can blame it on IE)You'll need a server-side language (PHP is my preference, ASP, or Cold Fusion also work) to take in the form data. Then you must make a script in your selected language to take in the form data and do something with it. I suggest putting the data in a data base (my data always prefers to hang out in a MySQL database).Then, maybe once a week, you can use a variant of Nakor''s script above to export the data to a file that you can import into Excel. Although, if you're just using the Excel file to keep track of things, you won't need to do that because your database will do it for you.So, step one, determine the type of server you have (Apache and Microsoft IIS are the mos common) and find out if you have a server-side programming language available to use. Check out your web host for information on this, as most paid web hosts will offer either PHP or ASP. Then, do the same to find out if and what kind of database(s) you have available.Get this and let us know and we can help more.

Hi mpoerThanks for your offer of help.I have 2 hosting packages, my main site lives on one (which I refer to as my shop window) & the second does all the work (refer to as workshop).The second one features 5.0GB transfer limit per month. 200MB webspace. 100 POP Boxes. 100 SMS messages per month. Full newsgroup access * Email redirection. Email filtering. Email responders. POP3 email delivery. Web based email access. Account control Interface. Group aliases. FTP access. Frontpage extension support. Graphical webstats on site traffic. Raw website access logs. Secure website hosting (SSL). Full CGI capability. UNIX shell account. Perl. Mysql capability. C Compiler. PHP functionality. Business technical support. Website access control (password protected). Unlimited local rate Internet access and email ** RAID hosting (Redundant Array of Independent Disks). Default CGI scripts (includes guestbook, counter & formmail). Domain name registration (.co.uk, .com, .org, org.uk, .net). which I think should cover form use. I presume the form action could point to the second site?Really appreciate the time you are taking.RegardsNeville

Share this post


Link to post
Share on other sites

You have PHP and MySQL, which are in my opinion very easy to start off with. You can have the form action point to wherever you want, as long as it is a script that you own (it would be useless to point to a script on someone else's domain). Let us know what you want to be able to do and we will help you out all we can.

Share this post


Link to post
Share on other sites
You have PHP and MySQL, which are in my opinion very easy to start off with. You can have the form action point to wherever you want, as long as it is a script that you own (it would be useless to point to a script on someone else's domain). Let us know what you want to be able to do and we will help you out all we can.

What I would ideally like is 1) Form data to be emailed to me on submit as it does now.2) Data stored for later interogation/search, ie. what type of property, price, name, etc.3) Add 'activity data', ie. client phoned, viewed 123 high street, etc. to a record :) Neville

Share this post


Link to post
Share on other sites

Actually, it sounds like you're looking for what I happen to be looking for, a client-relationship management system and gernal business tracking stuff. I've been looking around sourceforge - http://www.sourceforge.net for stuff like this. Give me a few days and I'll see what I can find.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...