...

View Full Version : Prompting user to save contents of textarea?



sina94
08-13-2004, 04:19 AM
Is there anyway to have a visitor to your site save the contents of a textarea on their hard drive?

sad69
08-13-2004, 04:38 AM
Yes, but not using pure Javascript (at least I can't think of one that won't require the use of ActiveX..). Using a server-side language it's pretty easy, like PHP:



<html>
<head>
<title>Save the contents of this textArea</title>
</head>

<body>
<form method="post" action="saveTextArea.php" target="_blank">
<textarea name="my_textarea"></textarea>
<input type="submit">
</form>
</body>
</html>




<?php
header("Content-type: application/octet-stream");
header("Content-Disposition: attachment; filename=my_textarea.txt");
header("Pragma: no-cache");
header("Expires: 0");

echo $_POST['my_textarea'];
?>


I'm pretty sure that's how you do it anyway..
Sadiq.

sina94
08-13-2004, 06:26 AM
The problem is that I've had trouble finding free webhosts that allow PHP...it's something I'd like to learn but I don't want to pay just to use it. I don't need a lot of bandwidth or anything... just to be able to use PHP.

If there's no way around using a server side language then I'd rather the contents of the textarea just be e-mailed to me. I was hoping I could just have them save it so they could e-mail it to me as a work around... but if not...

sina94
08-13-2004, 06:44 AM
Ok, I didn't have any problems this time. I found a free webhost no problem. PHP and everything according to them. So, lets get the whole thing set up rather than just the SSL part so I don't have to come back later asking for the Javascript part of it.

I want to have a series of forms on a page (one for each type of computer part) that allows them add the parts they own one at a time to a text area and then e-mail it to me. So there'd be a form for motherboards, hard drives, etc., and it would all show up in a textarea at the bottom of the page as they add it. Then when they're finished they can e-mail the list to me.

sad69
08-13-2004, 10:14 PM
Ok, I didn't have any problems this time. I found a free webhost no problem. PHP and everything according to them. So, lets get the whole thing set up rather than just the SSL part so I don't have to come back later asking for the Javascript part of it.

I want to have a series of forms on a page (one for each type of computer part) that allows them add the parts they own one at a time to a text area and then e-mail it to me. So there'd be a form for motherboards, hard drives, etc., and it would all show up in a textarea at the bottom of the page as they add it. Then when they're finished they can e-mail the list to me.

Ok.. so what's your question?

Also, do you want the user to send the email using their default mail client (using the mailto protocol), or do you want PHP to email it to you on the serverside? You may need to check with your webhost regarding SMTP (if there's one setup for PHP, in the php.ini file).

Sadiq.

sina94
08-15-2004, 04:22 AM
Ok, here's what a little bit of what I have...

HARDWARE<HR>
<DIV style="position: absolute; top: 350; left: 300; width: 250;">
<FONT style="text-decoration: underline;">Motherboard</FONT>
<FONT SIZE=2>
<FORM>
Manufacturer: &nbsp;<SELECT NAME="moboManufacturer">
<OPTION> Don't Know</OPTION>
<OPTION> Abit</OPTION>
<OPTION> Albatron</OPTION>
<OPTION> Asrock</OPTION>
<OPTION> Asus</OPTION>
<OPTION> Biostar</OPTION>
<OPTION> Chaintech</OPTION>
<OPTION> DFI</OPTION>
<OPTION> ECS</OPTION>
<OPTION> FIC</OPTION>
<OPTION> Gigabyte</OPTION>
<OPTION> Intel</OPTION>
<OPTION> Mach Speed</OPTION>
<OPTION> Micronics</OPTION>
<OPTION> MSI/Microstar</OPTION>
<OPTION> Shuttle</OPTION>
<OPTION> Soyo</OPTION>
<OPTION> Super Micro</OPTION>
<OPTION> Syntax</OPTION>
<OPTION> Tyan</OPTION>
<OPTION> XFX</OPTION>
<OPTION> Other</OPTION>
</SELECT>

<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;If other specify: &nbsp;<INPUT TYPE="text" NAME="moboOtherManufacturer" SIZE=13></INPUT>
<br>
CPU Module: &nbsp;<SELECT NAME="moboSocketType">
<OPTION> Don't Know</OPTION>
<OPTION> Slot 1</OPTION>
<OPTION> Slot 2</OPTION>
<OPTION> Socket 7</OPTION>
<OPTION> Socket 8</OPTION>
<OPTION> Socket 370</OPTION>
<OPTION> Socket 478</OPTION>
<OPTION> Socket 754</OPTION>
<OPTION> Socket A</OPTION>
<OPTION> Other</OPTION>
</SELECT>

<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;If other specify: &nbsp;<INPUT TYPE="text" NAME="moboOtherSocketType" SIZE=13></INPUT>
<br>
Quantity:
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;AGP/PCI/ISA&nbsp;&nbsp;
<INPUT SIZE=1 NAME="AGP" VALUE="00">/
<INPUT SIZE=1 NAME="PCI" VALUE="00">/
<INPUT SIZE=1 NAME="ISA" VALUE="00">
<br>
Controller: &nbsp;<SELECT NAME="moboController">
<OPTION> Don't Know</OPTION>
<OPTION> ATA</OPTION>
<OPTION> DMA</OPTION>
<OPTION> SCSI</OPTION>
<OPTION> Other</OPTION>
</SELECT>
<br>
Other Specs:<br>&nbsp;&nbsp;<TEXTAREA NAME="moboOtherSpecs">
</TEXTAREA><br>
<CENTER>
<INPUT TYPE="BUTTON" VALUE="ADD">
</CENTER>

</FORM>
</FONT>
</DIV>

I know I forgot the values in the option tags... I'll have to fill them in. But I want it to put all the specs into a textarea at the bottom of the page each time they click add. Then send the contents of the textarea to me when they're done. I don't think my host will allow SMTP through PHP... I know they won't through their regular e-mail accounts. Would there be an exception for PHP? And if not, could I use a third party server?

sina94
08-15-2004, 05:17 AM
Hello,

If you do not have a domain hosted with us, you cannot have maiboxes hosted with us, therefore you cannot use e-mails to do this.
Have a nice day.

Best Regards,
dibel
:: add comment :: Saturday, 14 August 2004, 22:11:33 by sina94
Is there any other way I could submit a form without registering a domain name?
:: add comment :: Saturday, 14 August 2004, 22:10:13 by dibel
Hello,

In order to be able to use SMTP on this sever, you need to register a domain name, host it with us and then create mailboxes for it. Then you can use those mailboxes to submit forms through PHP.
If you have any questions, don't hesitate to contact us.
Have a nice day.

Best Regards,
dibel


Asshole...

As5a5sIn5
08-15-2004, 10:45 PM
well if you wanna use PHP i suggest getting at ithium.net (http://ithium.net/) domain...only $10 a year :eek: also if your project is non-profit...krycek will probably host you for free.... :thumbsup:

:)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum