MadnessRed Posted May 21, 2008 Share Posted May 21, 2008 Hi, here is my script, there are 2 parts Part 1 <form action="changefr.php" method="get"> <strong><u>Friend 1</u></strong><br> Name: <input type="text" name="friend1" value="<?php include("../data/friends/friend1.txt"); ?>" /> Picture: <input type="text" name="pic1" value="<?php include("../data/friends/friend1_pic.txt"); ?>" /> Link: <input type="text" name="url1" value="<?php include("../data/friends/friend1_url.txt"); ?>" /> <br><br> <strong><u>Friend 2</u></strong><br> Name: <input type="text" name="friend2" value="<?php include("../data/friends/friend2.txt"); ?>" /> Picture: <input type="text" name="pic2" value="<?php include("../data/friends/friend2_pic.txt"); ?>" /> Link: <input type="text" name="url2" value="<?php include("../data/friends/friend2_url.txt"); ?>" /> <br><br> <strong><u>Friend 3</u></strong><br> Name: <input type="text" name="friend3" value="<?php include("../data/friends/friend3.txt"); ?>" /> Picture: <input type="text" name="pic3" value="<?php include("../data/friends/friend3_pic.txt"); ?>" /> Link: <input type="text" name="url3" value="<?php include("../data/friends/friend3_url.txt"); ?>" /> <br><br> <strong><u>Friend 4</u></strong><br> Name: <input type="text" name="friend4" value="<?php include("../data/friends/friend4.txt"); ?>" /> Picture: <input type="text" name="pic4" value="<?php include("../data/friends/friend4_pic.txt"); ?>" /> Link: <input type="text" name="url4" value="<?php include("../data/friends/friend4_url.txt"); ?>" /><br><br> <strong><u>Friend 5</u></strong><br> Name: <input type="text" name="friend5" value="<?php include("../data/friends/friend5.txt"); ?>" /> Picture: <input type="text" name="pic5" value="<?php include("../data/friends/friend5_pic.txt"); ?>" /> Link: <input type="text" name="url5" value="<?php include("../data/friends/friend5_url.txt"); ?>" /> <br><br> <strong><u>Friend 6</u></strong><br> Name: <input type="text" name="friend6" value="<?php include("../data/friends/friend6.txt"); ?>" /> Picture: <input type="text" name="pic6" value="<?php include("../data/friends/friend6_pic.txt"); ?>" /> Link: <input type="text" name="url6" value="<?php include("../data/friends/friend6_url.txt"); ?>" /> <br><br> <strong><u>Friend 7</u></strong><br> Name: <input type="text" name="friend7" value="<?php include("../data/friends/friend7.txt"); ?>" /> Picture: <input type="text" name="pic7" value="<?php include("../data/friends/friend7_pic.txt"); ?>" /> Link: <input type="text" name="url7" value="<?php include("../data/friends/friend7_url.txt"); ?>" /><br><br> <strong><u>Friend 8</u></strong><br> Name: <input type="text" name="friend8" value="<?php include("../data/friends/friend8.txt"); ?>" /> Picture: <input type="text" name="pic8" value="<?php include("../data/friends/friend8_pic.txt"); ?>" /> Link: <input type="text" name="url8" value="<?php include("../data/friends/friend8_url.txt"); ?>" /> <br><br> <strong><u>Friend 9</u></strong><br> Name: <input type="text" name="friend9" value="<?php include("../data/friends/friend9.txt"); ?>" /> Picture: <input type="text" name="pic9" value="<?php include("../data/friends/friend9_pic.txt"); ?>" /> Link: <input type="text" name="url9" value="<?php include("../data/friends/friend9_url.txt"); ?>" /> <br><br> <strong><u>Friend 10</u></strong><br> Name: <input type="text" name="friend10" value="<?php include("../data/friends/friend10.txt"); ?>" /> Picture: <input type="text" name="pic10" value="<?php include("../data/friends/friend10_pic.txt"); ?>" /> Link: <input type="text" name="url10" value="<?php include("../data/friends/friend10_url.txt"); ?>" /><br><br> <strong><u>Friend 11</u></strong><br> Name: <input type="text" name="friend11" value="<?php include("../data/friends/friend11.txt"); ?>" /> Picture: <input type="text" name="pic11" value="<?php include("../data/friends/friend11_pic.txt"); ?>" /> Link: <input type="text" name="url11" value="<?php include("../data/friends/friend11_url.txt"); ?>" /> <br><br> <strong><u>Friend 12</u></strong><br> Name: <input type="text" name="friend12" value="<?php include("../data/friends/friend12.txt"); ?>" /> Picture: <input type="text" name="pic12" value="<?php include("../data/friends/friend12_pic.txt"); ?>" /> Link: <input type="text" name="url12" value="<?php include("../data/friends/friend12_url.txt"); ?>" /> <br><br> <input type="submit" /> </form> Part 2 <?php // List the files to be written to $f1 = '../data/friends/friend1.txt'; $f1u = '../data/friends/friend1_url.txt'; $f1p = '../data/friends/friend1_pic.txt'; $f2 = '../data/friends/friend2.txt'; $f2u = '../data/friends/friend2_url.txt'; $f2p = '../data/friends/friend2_pic.txt'; $f3 = '../data/friends/friend3.txt'; $f3u = '../data/friends/friend3_url.txt'; $f3p = '../data/friends/friend3_pic.txt'; $f4 = '../data/friends/friend4.txt'; $f4u = '../data/friends/friend4_url.txt'; $f4p = '../data/friends/friend4_pic.txt'; $f5 = '../data/friends/friend5.txt'; $f5u = '../data/friends/friend5_url.txt'; $f5p = '../data/friends/friend5_pic.txt'; $f6 = '../data/friends/friend6.txt'; $f6u = '../data/friends/friend6_url.txt'; $f6p = '../data/friends/friend6_pic.txt'; $f7 = '../data/friends/friend7.txt'; $f7u = '../data/friends/friend7_url.txt'; $f7p = '../data/friends/friend7_pic.txt'; $f8 = '../data/friends/friend8.txt'; $f8u = '../data/friends/friend8_url.txt'; $f8p = '../data/friends/friend8_pic.txt'; $f9 = '../data/friends/friend9.txt'; $f9u = '../data/friends/friend9_url.txt'; $f9p = '../data/friends/friend9_pic.txt'; $f10 = '../data/friends/friend10.txt'; $f10u = '../data/friends/friend10_url.txt'; $f10p = '../data/friends/friend10_pic.txt'; $f11 = '../data/friends/friend11.txt'; $f11u = '../data/friends/friend11_url.txt'; $f11p = '../data/friends/friend11_pic.txt'; $f12 = '../data/friends/friend12.txt'; $f12u = '../data/friends/friend12_url.txt'; $f12p = '../data/friends/friend12_pic.txt'; // GET the text to write $friend1=$_GET["freind1"]; $url1=$_GET["url1"]; $pic1=$_GET["pic1"]; $friend2=$_GET["freind2"]; $url2=$_GET["url2"]; $pic2=$_GET["pic2"]; $friend3=$_GET["freind3"]; $url3=$_GET["url3"]; $pic3=$_GET["pic3"]; $friend4=$_GET["freind4"]; $url4=$_GET["url4"]; $pic4=$_GET["pic4"]; $friend5=$_GET["freind5"]; $url5=$_GET["url5"]; $pic5=$_GET["pic5"]; $friend6=$_GET["freind6"]; $url6=$_GET["url6"]; $pic6=$_GET["pic6"]; $friend7=$_GET["freind7"]; $url7=$_GET["url7"]; $pic7=$_GET["pic7"]; $friend8=$_GET["freind8"]; $url8=$_GET["url8"]; $pic8=$_GET["pic8"]; $friend9=$_GET["freind9"]; $url9=$_GET["url9"]; $pic9=$_GET["pic9"]; $friend10=$_GET["freind10"]; $url10=$_GET["url10"]; $pic10=$_GET["pic10"]; $friend11=$_GET["freind11"]; $url11=$_GET["url11"]; $pic11=$_GET["pic11"]; $friend12=$_GET["freind12"]; $url12=$_GET["url12"]; $pic12=$_GET["pic12"]; // Write the tex tto the file $handlef1 = fopen($f1, 'w'); fwrite($handlef1, $friend1); $handlef1u = fopen($f1u, 'w'); fwrite($handlef1u, $url1); $handlef1p = fopen($f1p, 'w'); fwrite($handlef1u, $pic1); $handlef2 = fopen($f2, 'w'); fwrite($handlef2, $friend2); $handlef2u = fopen($f2u, 'w'); fwrite($handlef2u, $url2); $handlef2p = fopen($f2p, 'w'); fwrite($handlef2u, $pic2); $handlef3 = fopen($f3, 'w'); fwrite($handlef3, $friend3); $handlef3u = fopen($f3u, 'w'); fwrite($handlef3u, $url3); $handlef3p = fopen($f3p, 'w'); fwrite($handlef3u, $pic3); $handlef4 = fopen($f4, 'w'); fwrite($handlef4, $friend4); $handlef4u = fopen($f4u, 'w'); fwrite($handlef4u, $url4); $handlef4p = fopen($f4p, 'w'); fwrite($handlef4u, $pic4); $handlef5 = fopen($f5, 'w'); fwrite($handlef5, $friend5); $handlef5u = fopen($f5u, 'w'); fwrite($handlef5u, $url5); $handlef5p = fopen($f5p, 'w'); fwrite($handlef5u, $pic5); $handlef6 = fopen($f6, 'w'); fwrite($handlef6, $friend6); $handlef6u = fopen($f6u, 'w'); fwrite($handlef6u, $url6); $handlef6p = fopen($f6p, 'w'); fwrite($handlef6u, $pic6); $handlef7 = fopen($f7, 'w'); fwrite($handlef7, $friend7); $handlef7u = fopen($f7u, 'w'); fwrite($handlef7u, $url7); $handlef7p = fopen($f7p, 'w'); fwrite($handlef7u, $pic7); $handlef8 = fopen($f8, 'w'); fwrite($handlef8, $friend8); $handlef8u = fopen($f8u, 'w'); fwrite($handlef8u, $url8); $handlef8p = fopen($f8p, 'w'); fwrite($handlef8u, $pic8); $handlef9 = fopen($f9, 'w'); fwrite($handlef9, $friend9); $handlef9u = fopen($f9u, 'w'); fwrite($handlef9u, $url9); $handlef9p = fopen($f9p, 'w'); fwrite($handlef9u, $pic9); $handlef10 = fopen($f10, 'w'); fwrite($handlef10, $friend10); $handlef10u = fopen($f10u, 'w'); fwrite($handlef10u, $url10); $handlef10p = fopen($f10p, 'w'); fwrite($handlef10u, $pic10); $handlef11 = fopen($f11, 'w'); fwrite($handlef11, $friend11); $handlef11u = fopen($f11u, 'w'); fwrite($handlef11u, $url11); $handlef11p = fopen($f11p, 'w'); fwrite($handlef11u, $pic11); $handlef12 = fopen($f12, 'w'); fwrite($handlef12, $friend12); $handlef12u = fopen($f12u, 'w'); fwrite($handlef12u, $url12); $handlef12p = fopen($f12p, 'w'); fwrite($handlef12u, $pic12); ?> Can someone please tell me whats wrong with it, the file paths are right, I have checked them and the files are chmodded to 777 any idea? Quote Link to comment https://forums.phpfreaks.com/topic/106599-help-with-a-fwrite-script/ Share on other sites More sharing options...
MadTechie Posted May 21, 2008 Share Posted May 21, 2008 personally i would used textarea, and POST, also your not closing the files. but then again you haven't said what the problem is. Quote Link to comment https://forums.phpfreaks.com/topic/106599-help-with-a-fwrite-script/#findComment-546360 Share on other sites More sharing options...
MadnessRed Posted May 21, 2008 Author Share Posted May 21, 2008 the error is the files were completly messed and it shoved all three things into 1 file, however that bit is fixed by changing " to ' in the php include the main problem though is that the files don't change. How do I close the file? Quote Link to comment https://forums.phpfreaks.com/topic/106599-help-with-a-fwrite-script/#findComment-546365 Share on other sites More sharing options...
MadTechie Posted May 21, 2008 Share Posted May 21, 2008 $handlef1 = fopen($f1, 'w'); fwrite($handlef1, $friend1); fclose($f1);<--Add Quote Link to comment https://forums.phpfreaks.com/topic/106599-help-with-a-fwrite-script/#findComment-546371 Share on other sites More sharing options...
MadnessRed Posted May 21, 2008 Author Share Posted May 21, 2008 ok kl, doesn't look too hard thanks Quote Link to comment https://forums.phpfreaks.com/topic/106599-help-with-a-fwrite-script/#findComment-546392 Share on other sites More sharing options...
MadnessRed Posted May 21, 2008 Author Share Posted May 21, 2008 Also I found some more errors myself $friend1=$_GET["freind1"]; mispelling of friend $handlef1p = fopen($f1p, 'w'); fwrite($handlef1u, $pic1); should say $handlef1p there Quote Link to comment https://forums.phpfreaks.com/topic/106599-help-with-a-fwrite-script/#findComment-546397 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.