LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 09-03-2007, 11:41 PM   #1
bezdomny
Member
 
Registered: May 2006
Location: North-Central California
Distribution: Debian Lenny
Posts: 154

Rep: Reputation: 30
Question how to design interactive contact form for web page?


I am the new webmaster for a non-profit and would like to use Iceape Composer and Bluefish for my work as they are free-of-charge (and Iceape composer will be a great help because of its wysiwyg interface-- my HTML coding skills are quite out-ot-date).

I would like to have a contact form where clients could input their names, and phone numbers and e-mail addresses and the form would either e-mail that to the webmaster, or post it to a file on the server the webmaster could regularly check.

If you can help me do this, perhaps help me script a template, or tell me what back-end services would be required to be supported on my server (PHP? ASP?) please help me. Thank you!
 
Old 09-04-2007, 01:09 AM   #2
Nailbar
LQ Newbie
 
Registered: Apr 2007
Location: Finland
Distribution: Linux MINT 6
Posts: 12
Blog Entries: 1

Rep: Reputation: 0
To save form data to a file is pretty simple. I'd use PHP, but that's just what I'm used to.

Here's a small example script to help you on your way.

The script you post to:

Code:
<?php

//Check that the user actually sent data
if(!isset($_POST['data1'])) exit('Variable data1 missing!');
if(!isset($_POST['data2'])) exit('Variable data2 missing!');

//Get the stuff posted
$data1=$_POST['data1'];
$data2=$_POST['data2'];

//Save it to the file
if($fh=fopen('thefile.txt','a')){ //Open file for writing
  fwrite($fh,$data1."\n"); //Write first data string to file
  fwrite($fh,$data2."\n\n"); //Write second data string
  fclose($fh); //Close the file
}else exit('Could not save form data!'); //If the file could not be opened

//Tell the user it's all good
echo "Thank you, your form has been recieved...";

?>
The file 'thefile.txt' must be writable by the server.

This is all without authentication so you should look into session variables or cookies too to avoid evil doings.

Read more on www.php.net
 
Old 09-05-2007, 11:26 AM   #3
bezdomny
Member
 
Registered: May 2006
Location: North-Central California
Distribution: Debian Lenny
Posts: 154

Original Poster
Rep: Reputation: 30
Smile how to design interactive contact form for web page?

Thank you so much, Nailbar! And then I would write an HTML page using the "form" tag, and "post" method pointed to the php page, right? And the three files, the form-html page, the php file, and the underlying text.file would all be in the same directory, right?

Thanks again and best regards,

B3zdomny, aka The Poet Homeless
 
Old 09-06-2007, 11:03 AM   #4
Nailbar
LQ Newbie
 
Registered: Apr 2007
Location: Finland
Distribution: Linux MINT 6
Posts: 12
Blog Entries: 1

Rep: Reputation: 0
Yeah..

Here's a quick example for the form too, since you said you were out-of-date and all.

Code:
<form method="post" action="store.php">
  <p>
    Data 1: <input type="text" name="data1"/><br/>
    Data 2: <input type="text" name="data2"/><br/>
    <input type="submit" value="Send data"/>
  </p>
</form>
Enjoy your coding

And some recommended reading.. www.w3schools.com is where I learned all my web programming.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Need a contact form vafe Linux - Software 2 05-23-2007 08:58 AM
Web page design software? A6Quattro Linux - Software 8 08-10-2005 11:11 PM
set focus on a text form of a web page? codec Programming 2 12-31-2004 05:32 AM
Kicking off a script form a web page Hazzie Programming 2 04-26-2004 02:09 PM
Interactive website form help micro_sucks General 0 12-24-2003 09:27 PM


All times are GMT -5. The time now is 07:41 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration