|
|
#1 (permalink) |
|
Registered User
Join Date: Jan 2003
Location: UK
Posts: 928
|
create a file based on form input (php?)
Hi all,
im wanting to create a html file based on whats entered into a form ive searched google for almost 2 days now and not found anything, ive searched the php manual too but cant find any function there for creating html files.. ...or maybe im just not good at searching :\ any help would be appreciated thanks -c0lin |
|
|
|
|
|
#2 (permalink) |
|
Registered User
Join Date: Sep 2002
Posts: 824
|
Ok colin here are two cases for ur question and two solutions based on php:
U want to create a file on harddisk: http://www.php.net/manual/en/function.fopen.php Now if u want to send a html file as reply for form submission then, http://www.php.net/manual/en/tutorial.forms.php
__________________
We all are practical in our interests but, idealist when it concerns others.... Last edited by Asterix; 02-29-2004 at 09:39 PM. |
|
|
|
|
|
#4 (permalink) |
|
Registered User
Join Date: Sep 2002
Posts: 824
|
well that..
u can do that like this say u have a form like this Code:
<form action="act.php" method="GET"> <input type="text" name="file"> <input type"submit"> Code:
<?php echo $_GET["file"]; ?>
__________________
We all are practical in our interests but, idealist when it concerns others.... |
|
|
|
|
|
#7 (permalink) |
|
Registered User
Join Date: Jan 2003
Location: UK
Posts: 928
|
thanks for the replys
i tried adding the $_GET["file"] to my existing php script like below: PHP Code:
Warning: fopen() expects at least 2 parameters, 1 given in /home/colinuk/public_html/test/add.php on line 5 whats wrong? (its probably somthing obvious) Last edited by c0lin; 03-01-2004 at 04:11 PM. |
|
|
|
|
|
#8 (permalink) |
|
Da House Nerd
Join Date: Dec 1969
Location: One CPU Lane
Posts: 3,512
|
hehe...
fopen($server_path .$_GET['filename']. "a") the dot in front of "a" should be a comma (,), then it works... However GET probably won't work here, use $_POST instead, but why not helping yourself and using $_REQUEST for all? ($_REQUEST is a union of $_GET and $_POST)
__________________
Linux virusscanner detected a virus: Windows 95 ... delete [Y/n] y ~ ~ :wq |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|