|
Posted by Chris F.A. Johnson on 08/30/06 19:32
On 2006-08-30, Dave Kelly wrote:
> I would like to set up an online sign up sheet for club members to go on
> a fishing trip.
>
> I have googled and read so much this past week I am getting confused.
>
> Using this code snippet:
>
> ===cut====
><body>
>
><?
> if (isset($_POST["confirm"]))//posted?
> {
> //php must have write-access in this directory
> $fp=fopen("data.txt","w");//overwrite existing text file
> fwrite($fp,$_POST['name']));//write post-data
> fclose($fp);
> }
> ?>
This is PHP, not a shell script. If you really want to use PHP,
post it to a PHP newsgroup.
><p>This is the sign up sheet for the South Padre Island Sandifer
> Surffest</p><br clear="all"></p>
>
>
><form action='<?=$_SERVER["PHP_SELF"]?>' method="post">
> Name <input type=text name=name size=40 maxlength=30>
> Email <input type=text name=email address size=40 maxlength=40>
> Phone <input type=text name=phone size=12 maxlenght=30>
><input type="submit" name="confirm">
></form>
>
></body>
> ===cut===
> If I use this line:
><form action="confirm" method="post">
> my FF browser window changed to the directory 'confirm' and clicking on
> the 'data.txt' file shows nothing has happened.
>
> If I use this line;
><form action='<?=$_SERVER["PHP_SELF"]?>' method="post">
> I have this in my browser navigation box:
> file:///root/My%20Documents/code/signup/%3C?=$_SERVER[%22PHP_SELF%22]?%3E
> and a file not found error.
>
> I have been testing on my own system before uploading anything to the
> web server.
>
> Does anyone have a different direction for me to go. Perhaps a tutorial
> that assumes I don't know what I am doing.
As I told you in another group, I'd use a shell script. Have a look
at this form and the CGI script that processes it:
<http://cfaj.freeshell.org/email.shtml> (form)
<http://cfaj.freeshell.org/smail.txt> (CGI script)
<http://cfaj.freeshell.org/email.css> (style sheet)
The script needs more, but it works as is.
--
Chris F.A. Johnson, author <http://cfaj.freeshell.org>
Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)
===== My code in this post, if any, assumes the POSIX locale
===== and is released under the GNU General Public Licence
[Back to original message]
|