if (isset($url) && isset($text))
{       $fp = fopen("file.txt", "w");
        $anothervar = fputs($fp, "<a href='$url'>$text</a><br>", "r+");
        $anothervar = fclose($fp);
}

echo "<form method='post' action='#'>";
echo "<input type='text' name='url' size=20" value='http://'>";
echo "<input type='text' name='text' size=20>";
echo "<input type='submit' name='submit' value='Generate New Link'>";
 
echo "</form>";

        Tim Ward
        Senior Systems Engineer

Please refer to the following disclaimer in respect of this message:
http://www.stivesdirect.com/e-mail-disclaimer.html


> -----Original Message-----
> From: chris herring [mailto:[EMAIL PROTECTED]]
> Sent: 28 March 2001 06:17
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP] Blah I'm Stupid
> 
> 
> ok here's the script i have, and i keep getting errors
> 
> <?
> $fp = fopen("file.txt", "w");
> $fp = fputs("file.txt", "<a href=\"$url\">$text</a><br>", "r+");
> $fp = fclose("file.txt");
> 
> echo "<form method=\"post\" action=\"$fp\">";
> echo "<input type=\"text\" name=\"url\" size=\"20\" 
> value=\"http://\">";
> echo "<input type=\"text\" name=\"text\" size=\"20\">";
> echo "<input type=\"submit\" name=\"submit\" value=\"Generate 
> New Link\">";
> 
> echo "</form>";
> ?>
> 
> what's wrong with it. it says it's with the fputs and fclose things.
> ----- Original Message -----
> From: "David Robley" <[EMAIL PROTECTED]>
> To: "chris herring" <[EMAIL PROTECTED]>;
> <[EMAIL PROTECTED]>
> Sent: Tuesday, March 27, 2001 11:06 PM
> Subject: Re: [PHP] Blah I'm Stupid
> 
> 
> > On Wed, 28 Mar 2001 14:31, chris herring wrote:
> > > ----- Original Message -----
> > > From: "David Robley" <[EMAIL PROTECTED]>
> > > To: "chris herring" <[EMAIL PROTECTED]>;
> > > <[EMAIL PROTECTED]>
> > > Sent: Tuesday, March 27, 2001 10:19 PM
> > > Subject: Re: [PHP] Blah I'm Stupid
> > >
> > > > On Wed, 28 Mar 2001 13:44, chris herring wrote:
> > > > > > I got a question here. How would you go about 
> calling variables
> > > > > > from a
> > > > >
> > > > > form. I'm sure this is super-easy, but I'm a newbie. 
> Any help would
> > > > > be greatly appreciated.
> > > >
> > > > Just prefix the form object names with $
> > > >
> > > > Say you have a text box set up like so:
> > > >
> > > > <FORM ACTION=check.php METHOD=GET>
> > > > <input type="text" name="avail" value="">
> > > > <INPUT TYPE=SUBMIT>
> > > > </FORM>
> > > >
> > > > and in check.php
> > > >
> > > > <?php echo $avail; ?>
> > > >
> > > > will show the value entered in the text box
> >
> > > how would you go about writing that data do a text file then?
> >
> > File system functions. fopen the file you want to put the 
> data in, fwrite
> > the values from the variable(s) to the file and fclose the 
> file at the
> > end of the process.
> >
> > Note the ways you can open a file with fopen; and be aware of file
> > permission problems because this is done as the user the 
> web server runs
> > as (*nix, dunno about windows).
> >
> > --
> > David Robley                        | WEBMASTER & Mail List Admin
> > RESEARCH CENTRE FOR INJURY STUDIES  | 
> http://www.nisu.flinders.edu.au/
> > AusEinet                            | 
> http://auseinet.flinders.edu.au/
> >             Flinders University, ADELAIDE, SOUTH AUSTRALIA
> 
> 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to