Warptweet Posted January 14, 2007 Share Posted January 14, 2007 I have a drop-down list in my forms.It has the following:None (Value: 1)Mild (Value: 2)Excessive (Value: 3)Extreme (Value: 4)So, what code would I use to check which of the following in the drop-down list was selected?Would I check...[code]<?phpif($_POST['flashviolence']=1{$flashviolence = 1}if($_POST['flashviolence']=2{$flashviolence = 2?>[/code]Is that how I would check what was selected?ONE MORE QUESTION:If I wanted to write more than one paragraph in a file, how would I make a double space in order to space out the paragraphs? Link to comment https://forums.phpfreaks.com/topic/34086-check-if-option-is-selected/ Share on other sites More sharing options...
ted_chou12 Posted January 14, 2007 Share Posted January 14, 2007 change:if($_POST['flashviolence']=1{toif($_POST['flashviolence']=="1"){ Link to comment https://forums.phpfreaks.com/topic/34086-check-if-option-is-selected/#findComment-160243 Share on other sites More sharing options...
Warptweet Posted January 14, 2007 Author Share Posted January 14, 2007 Thanks, does anyone have an answer to my other question?If I have multiple paragraphs to write to a file, how would I make a DOUBLE SPACE, in order to space out the paragraphs?EXAMPLE:The fox was cunning and jumped over the wall easily.The fox was smart and leaped from behind.The fox was small and glided overhead.(SPACE, NOTHING)The fox was cunning and jumped over the wall easily.The fox was smart and leaped from behind.The fox was small and glided overhead.And Where (SPACE, NOTHING) was, make a complete space, bare, just a double space. Link to comment https://forums.phpfreaks.com/topic/34086-check-if-option-is-selected/#findComment-160251 Share on other sites More sharing options...
ted_chou12 Posted January 14, 2007 Share Posted January 14, 2007 /r/nTed Link to comment https://forums.phpfreaks.com/topic/34086-check-if-option-is-selected/#findComment-160252 Share on other sites More sharing options...
Warptweet Posted January 14, 2007 Author Share Posted January 14, 2007 Is that /r/n both together to make a space? Or is it EITHER /r OR /n? Link to comment https://forums.phpfreaks.com/topic/34086-check-if-option-is-selected/#findComment-160256 Share on other sites More sharing options...
ted_chou12 Posted January 14, 2007 Share Posted January 14, 2007 sorry... is \r\n backslash... :P Link to comment https://forums.phpfreaks.com/topic/34086-check-if-option-is-selected/#findComment-160257 Share on other sites More sharing options...
ted_chou12 Posted January 14, 2007 Share Posted January 14, 2007 it depends on your server, put them both on would be a better idea. Link to comment https://forums.phpfreaks.com/topic/34086-check-if-option-is-selected/#findComment-160259 Share on other sites More sharing options...
corbin Posted January 14, 2007 Share Posted January 14, 2007 If I remember correctly, \r makes a new line on mac/linux and \n makes a new line on windows... I personally always use \r\n... Link to comment https://forums.phpfreaks.com/topic/34086-check-if-option-is-selected/#findComment-160267 Share on other sites More sharing options...
Warptweet Posted January 14, 2007 Author Share Posted January 14, 2007 Umm....Unfortunately, this does not work :(\r\n does not create a space.Remember...I'm WRITING \r\n to a file, so would this work?I'm using this to write to a file...$datastring = "\r\n"fwrite($o,$datastring)EDIT: By the way, I of course used the fopen and everything, the above code is simply the writing part only, and the writing part alone. Link to comment https://forums.phpfreaks.com/topic/34086-check-if-option-is-selected/#findComment-160294 Share on other sites More sharing options...
corbin Posted January 14, 2007 Share Posted January 14, 2007 So wait... what are you trying to do? Are you trying to put " " or a line break into a file? Link to comment https://forums.phpfreaks.com/topic/34086-check-if-option-is-selected/#findComment-160296 Share on other sites More sharing options...
Warptweet Posted January 14, 2007 Author Share Posted January 14, 2007 The Fox was nice.The Fox was smart.The Fox was cunning.The Fox was agile.The Fox was nothing.The Fox was everything.The Fox was something.-----------------------------------See how those two paragraphs were space out? See how "The Fox was agile" and "The Fox was Nothing" were seperate by a double space?Think of it as you are writing an essay with paragraphs, and you need to double space your paragraphs. Link to comment https://forums.phpfreaks.com/topic/34086-check-if-option-is-selected/#findComment-160297 Share on other sites More sharing options...
ted_chou12 Posted January 14, 2007 Share Posted January 14, 2007 [code]<?php$file = fopen("test.txt","a");$write = fwrite($file,"The Fox was nice.The Fox was smart.The Fox was cunning.The Fox was agile.The Fox was nothing.The Fox was everything.The Fox was something.");?>[/code]I believe this should also workTed Link to comment https://forums.phpfreaks.com/topic/34086-check-if-option-is-selected/#findComment-160299 Share on other sites More sharing options...
Warptweet Posted January 14, 2007 Author Share Posted January 14, 2007 The file I am writing to is a .php file, will that still work? Link to comment https://forums.phpfreaks.com/topic/34086-check-if-option-is-selected/#findComment-160301 Share on other sites More sharing options...
Warptweet Posted January 14, 2007 Author Share Posted January 14, 2007 Also, I would have tried that.. BUT.. Heres the problem...[code]$o = fopen("211612151419/".$_POST['flashname'].".php", "w");$stringData = "<html><head><meta http-equiv=\"Content-Language\" content=\"en-us\"><meta name=\"GENERATOR\" content=\"Microsoft FrontPage 5.0\"><meta name=\"ProgId\" content=\"FrontPage.Editor.Document\"><meta http-equiv=\"Content-Type\" content=\"text/html; charset=windows-1252\"><title>Warptweet.com >>> Flash Portal >>> Content</title></head><body background=\"images/warpback.bmp\" text=\"#FFDF12\" link=\"#FFDF12\" vlink=\"#FFFF12\" alink=\"#FFFF00\"><div align=\"center\" style=\"width: 960; height: 696\"> <center> <p> <a href=\"http://www.warptweet.com\"> <img border=\"0\" src=\"images/warpbanner.bmp\" width=\"425\" height=\"75\" alt=\"Copyright © 2007 Warptweet.com\"></a></p> <table border=\"1\" cellpadding=\"0\" cellspacing=\"0\" style=\"border-collapse: collapse\" bordercolor=\"#111111\" width=\"753\" height=\"1\"> <tr> <td width=\"751\" height=\"27\" bordercolorlight=\"#454545\" bordercolordark=\"#454545\" bgcolor=\"#454545\" valign=\"top\" align=\"center\"> <map name=\"FPMap0\"> <area href=\"index.php\" shape=\"rect\" coords=\"1, 1, 199, 40\"> <area href=\"flashportal.php\" shape=\"rect\" coords=\"201, 1, 529, 40\"> <area href=\"uploadflash.php\" shape=\"rect\" coords=\"533, 0, 759, 40\"> </map> <img border=\"0\" src=\"images/warpbuttons.bmp\" usemap=\"#FPMap0\" width=\"760\" height=\"41\"></td> </tr> <tr> <td width=\"751\" height=\"640\" bordercolorlight=\"#FFFFFF\" bordercolordark=\"#FFFFFF\" bgcolor=\"#454545\" valign=\"top\" align=\"center\"> <p>";fwrite($o, $stringData);$stringData = $_POST['flashname'];fwrite($o, $stringData);$stringData = "\r\n\r\n";fwrite($o, $stringData);$stringData = $_POST['flashauthor'];fwrite($o, $stringData);$stringData = "\r\n\r\n";fwrite($o, $stringData);$stringData = $_POST['flashdescription'];fwrite($o, $stringData);$stringData = "\r\n\r\n";fwrite($o, $stringData);$stringData = "Commentary: \r\n $flashcommentary"; //131fwrite($o, $stringData);$stringData = "\r\n\r\n";fwrite($o, $stringData);$stringData = "$flashviolence$flashaudio$flashtext$flashadult$flashnudity";fwrite($o, $stringData);$stringData = "<A HREF=\"javascript:void(0)\"ONCLICK=\"window.open('http://www.warptweet.com/211612151419/$randnum','miniwin','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=$flashwidth,height=$flashheight')\">Watch this Flash!</a>";fwrite($o, $stringData);$stringData = "</td> </tr> </table> </center></div></body></html>";fwrite($o, $stringData);[/code]Thats the code I'm using.So, as you can see, I'm using TONS of fwrite functions over and over and over and over and over again, and I plan to keep it that way. FOR VERY GOOD, PERSONAL REASONS.So in this case, I need a real code like \r\n except one that works to accomplish this spacing. Link to comment https://forums.phpfreaks.com/topic/34086-check-if-option-is-selected/#findComment-160310 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.