akimm
-
Posts
3 -
Joined
-
Last visited
Never
Posts posted by akimm
-
-
This file is meant to glob() my entrys directory, and pull all txt extension files into a foreach loop, which will then be printed with a yes or no below them. The yes means I approve the file and want it to be written to the server in guestbook.txt which can then be used as my guestbook entry file, after its written I want it unlinked anyway because it will be written to a new fie. If i click no, I want the file to be unlinked immediately.
approve.php
[code]
<?php
foreach (glob("entrys/*.txt") as $files) {
?>
<table>
<form method="POST" action="ad.php">
<tr><td><?php include($files);?></td></tr>
<tr><td><h2>yes</h2></td><br>
<td><input type="radio" name="name" value="yes" id="yes"><label for="yes">Yes</label></td></tr>
<tr><td><h2>no</h2></td><br>
<td><input type="radio" name="name" value="no" id="no"><label for="no">No</label><</td></tr>
<?php
echo "</table>";
}
?>
<input type="submit" value="submit for addition to guestbook" name="guestbook">
</form>
[/code]
[code]
ad.php
<?php
$fp = fopen('guestbook.txt', 'w');
if($_POST['name'] == "yes" && $fp) {
fwrite($fp, $files);
fclose($fp);
unlink($_POST['name']);
}
if($_POST['name'] == "no") {
unlink($_POST['name']);
}
?>
[/code]
I appreciate any assistance, thanks in advance. -
I'm using glob to bring about all the smileys in my one directory into a select menu. It does this fine, I select my smile i chose to use, then submit the form, during the writing however, instead of chosing the name of the smile hypothetically smile1.gif, it numerically lables the smiles like an array. My problem is I need to use the exact name for the smile and I need to also attach <img src="$_POST[''smile]"> into my php file that does the writing process. I will post my code thus far, anyone who can help is greatly appreciated.
<form action="journalbox.php" method="POST"><p><b>Date</b><input type="text" value="<b><?php echo date('F j, Y, g:i a');?
></b>" name="date" size="30"></p><p><b>Mood</b>
<select name="mood"><option value="apathetic">apathetic<option value="overjoyed">overjoyed<option
value="inquisitive">inquisitive<option value="outlandish">outlandish<option value="appreciative">appreciative<option
value="confused">confused<option value="displeased">displeased<option value="disgruntled">disgruntled<option
value="sick">sick<option value="terrified">terrified<option value="mental">mental<option value="eruditic">eruditic<option
value="forlorn">forlorn<option value="convuluted">convuluted<option value="ingenious">ingenious<option
value="arrogant">arrogant<option value="free">free<option value="stupid">stupid<option value="moronic">moronic<option
value="pointless">pointless</select><br /><br />
<select name="smile">
This is the form
[code=php:0]
<?php
$files = glob("smile/*.gif");
##Display $files
foreach ($files as $key => $value)
{
echo '<option value="' . $key . '">' . $value . '</option>';
}
?>
</select>
<p><b>entry</b><TEXTAREA NAME="entry" COLS="80" ROWS="5" WRAP="virtual"></TEXTAREA></P><p><input type="submit" name="submit"
value="send your entry!"></p></form>
[/code]
this is the file that writes to my directory
[code=php:0]
<?php
$filename = "journalaug_sept.txt";
$handle = fopen($filename, 'a');
$write_string = $_POST['date'] . "<font family=arial>" . "<BR>" . "<BR>";
$write_string .= $_POST['mood'] . "<font family=arial>" . "<BR>" . "<BR>";
$write_string .= $_POST['smile'] . "<br>";
$write_string .= $_POST['entry'] . "<font family=arial>" . "<BR>" . "<BR>";
$write_string .= "<HR NOSHADE SIZE=4 COLOR=BLUE>";
fwrite($handle, $write_string);
fclose($handle);
?>
<h1>Sucessfully posted</h1>
<br><br>
<?php
echo $_POST['date'] . "<br>";
echo $_POST['mood'] . "<br>";
echo $_POST['smile'] . $_POST['value'] . "<br>";
echo $_POST['entry'] . "<br>";
?>
<br><br>
<a href="http://www.akimm.com/journal06/journal.php">Go To Journal Sean!</a>
[/code]
unlink() error
in Third Party Scripts
Posted