/    Sign up×
Community /Pin to ProfileBookmark

[HELP?] Form question

Hello there,

This is my form:

[code=php]<?php print “$site”; ?>
<form action=”save.php” enctype=”multipart/form-data” method=”post”>
<p>&nbsp;</p>
<table border=”0″ cellspacing=”2″>
<textarea rows=”20″ cols=”70″ name=”message” type=”file”><?php include (‘../’.”$site”); ?></textarea></td></tr>
<tr><td>&nbsp;</td><td><input type=”submit” value=”Save”></td></tr>
</table>
</form>[/code]

Now, when I click the submit button, I would like to have the .php code that was in the text box to be saved into the directory on the server: ../$site.
So basically save it to ‘../’.”$site”

Any help with the .php script (which is as you can see, called save.php), would be appreciated.

Ps: I have to use the fwrite function, right?

Grtz,
SaRs!

to post a comment
PHP

5 Comments(s)

Copy linkTweet thisAlerts:
@Sars_authorFeb 22.2008 — BUMP

40 views, no replies?

Nobody who can help me?
Copy linkTweet thisAlerts:
@FrostBiteFeb 22.2008 — Please see php's fopen() function. There's nice little links at the bottom for fwrite ect.

-Frosty
Copy linkTweet thisAlerts:
@Sars_authorFeb 22.2008 — Thanx, it actually works now ?

Thanks a heaps again ?

Grtz,

SaRs!
Copy linkTweet thisAlerts:
@Sars_authorFeb 22.2008 — Now I have a new question:

If I declare a variable in the fputs function, it doesn't work:
[code=php]<?php

$handle = fopen("../inhoud/"."$site", "r+");
fputs($handle, $message)

?>
[/code]


It should put it in the ../inhoud/$site directory, but it won't :o

Thx for the help already,

SaRs!
Copy linkTweet thisAlerts:
@Sars_authorFeb 22.2008 — I got everything working already ?
×

Success!

Help @Sars_ spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...