hakermania Posted May 6, 2011 Share Posted May 6, 2011 I've created this code in PHP and I'm a complete newbie (i've done something in the past regarding email-sending but nothing more...) So, as I put this code inside my .php file and request it to load, an empty page is presented. What is the actual problem to the code? Thx in advance for any answer! <?php $wfilename = $_POST["wfilename"]; $wbody = $_POST["wbody"]; $rfilename = $_POST["rfilename"]; ?> <html> <head> <title>Write/Read files!</title> </head> <body> <h1>WRITE FILES</h1> <form method="post" action="<?php echo $PHP_SELF;?>"> Write filename:<input type="text" size="30" maxlength="30" name="wfilename">:<br /> Body:<br /><textarea rows="20" cols="20" name="wbody" wrap="physical"></textarea><br /> <input type="submit" value="write" name="write"><br /> </form><br /> <br /> <h1>READ FILES</h1> <form method="post" action="<?php echo $PHP_SELF;?>"> Write filename:<input type="text" size="30" maxlength="30" name="rfilename"><br /> <input type="submit" value="read" name="read"><br /> </form><br /> <?php if ($_POST['read']) { $fh = fopen($rfilename, 'r') or die(""); $theData = fread($fh, 5); fclose($fh); echo "$rfilename contains:\n\n$theData"; } else if ($_POST['write']) { $fh = fopen($wfilename, 'w') or die("can't open file"); fwrite($fh, $wbody); fclose($fh); echo "$wbody was successfully written to $wfilename" } Link to comment https://forums.phpfreaks.com/topic/235713-php-multiple-forms-submission/ Share on other sites More sharing options...
diptiranjan Posted May 6, 2011 Share Posted May 6, 2011 create this it'll work and follow the same and php manual you can easily do if any doubt contact me [attachment deleted by admin] Link to comment https://forums.phpfreaks.com/topic/235713-php-multiple-forms-submission/#findComment-1211539 Share on other sites More sharing options...
diptiranjan Posted May 6, 2011 Share Posted May 6, 2011 you can follow this .this will be better [attachment deleted by admin] Link to comment https://forums.phpfreaks.com/topic/235713-php-multiple-forms-submission/#findComment-1211558 Share on other sites More sharing options...
hakermania Posted May 7, 2011 Author Share Posted May 7, 2011 Thank you very much! This worked! Link to comment https://forums.phpfreaks.com/topic/235713-php-multiple-forms-submission/#findComment-1211975 Share on other sites More sharing options...
diptiranjan Posted May 8, 2011 Share Posted May 8, 2011 welcome hakermania Link to comment https://forums.phpfreaks.com/topic/235713-php-multiple-forms-submission/#findComment-1212284 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.