Jump to content

Check if Option is Selected?


Warptweet

Recommended Posts

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]<?php
if($_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

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.
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.
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.
[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 work
Ted
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"; //131
fwrite($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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.