| View previous topic :: View next topic |
| Author |
Message |
gowator n00b


Joined: 10 Jun 2004 Posts: 49 Location: France 75
|
Posted: Fri Aug 19, 2005 11:14 am Post subject: Simplest Web account details collection |
|
|
I haven't much experience making interactive web sites but I need to add a collect account info type submit...
Plain text is fine... the simpler the better I just need a form with name + email contact and submit button !!
can anyone help out? php/whatever is simplest |
|
| Back to top |
|
 |
rjs Tux's lil' helper

Joined: 30 Jul 2004 Posts: 146 Location: Oriel College, Oxford
|
Posted: Fri Aug 19, 2005 12:28 pm Post subject: |
|
|
I use something like this on my site. It emails you with the details of whatever the user submitted:
| Code: |
if ($submit_information)
{
$date=date("Y\\-m\\-d");
$real_name=$_POST['real_name'];
$email_address=$_POST['email_address'];
$ip=$_SERVER['REMOTE_ADDR'];
mail('your_email_address@your_domain.com',
'User with name: '.$real_name.', and email address: '.$email_address', submitted their information. IP address: '.$ip'. Date: '.$date,
'From: user_submission@your_domain.com');
?>
<p>Thank you for your submission</p>
<?php
}
else
{
?>
<form action="<?php echo $PHP_SELF; ?>" method="post" >
<fieldset>
<input type="text" name="real_name" value="name" />
<input type="text" name="email_address" value="email" />
<input type="submit" name="submit_information" value="Send Information" />
</fieldset>
</form>
<?php
}
|
You need to have PHP running, and sendmail to email the information to yourself. Oh and you have to change the email stuff to your own details/custom message. Obviously. Hope this helps. |
|
| Back to top |
|
 |
gowator n00b


Joined: 10 Jun 2004 Posts: 49 Location: France 75
|
Posted: Fri Aug 19, 2005 2:18 pm Post subject: |
|
|
Looks good ....
How about just writing a simple text file? The computer in question doesn't have routing for the mail because the ISP refuses to forward though I guess it can send it locally... but that's the basic idea
thx |
|
| Back to top |
|
 |
rjs Tux's lil' helper

Joined: 30 Jul 2004 Posts: 146 Location: Oriel College, Oxford
|
Posted: Fri Aug 19, 2005 3:22 pm Post subject: |
|
|
Writing to a file is just as easy. Substitute the emailing part for something like this:
| Code: |
$date=date("Y\\-m\\-d");
$real_name=$_POST['real_name'];
$email_address=$_POST['email_address'];
$ip=$_SERVER['REMOTE_ADDR'];
$string= $real_name . '-' . $email_address . '-' . $ip . '-' . $date;
// Open the file
$file = fopen("/path/to/user_information.txt", "a");
// Write the data to the file
fwrite($file, $string);
// Close the file
fclose($file);
|
Oh, in case you don't know much about PHP syntax, the $variable . 'some random text' . $variable concatenats the three strings to create a single string. I just thought it looked a bit confusing up there ^
And the fopen("/path","a") command means open the file specified for writing on a new line at the end. So you will get a file that has the latest user submitted info at the bottom. |
|
| Back to top |
|
 |
gowator n00b


Joined: 10 Jun 2004 Posts: 49 Location: France 75
|
Posted: Sat Aug 20, 2005 9:16 am Post subject: |
|
|
| Thanks ... that looks perfect now... |
|
| Back to top |
|
 |
|