Click here to Skip to main content
15,903,626 members
Home / Discussions / Linux, Apache, MySQL, PHP
   

Linux, Apache, MySQL, PHP

 
GeneralRe: Radio Buttons Pin
thebiostyle30-Dec-09 13:34
thebiostyle30-Dec-09 13:34 
GeneralRe: Radio Buttons [modified x2] Pin
enhzflep30-Dec-09 13:41
enhzflep30-Dec-09 13:41 
GeneralRe: Radio Buttons Pin
thebiostyle30-Dec-09 13:59
thebiostyle30-Dec-09 13:59 
GeneralRe: Radio Buttons Pin
enhzflep31-Dec-09 7:04
enhzflep31-Dec-09 7:04 
GeneralRe: Radio Buttons Pin
thebiostyle31-Dec-09 7:13
thebiostyle31-Dec-09 7:13 
GeneralRe: Radio Buttons Pin
enhzflep31-Dec-09 13:05
enhzflep31-Dec-09 13:05 
GeneralRe: Radio Buttons Pin
thebiostyle31-Dec-09 18:13
thebiostyle31-Dec-09 18:13 
GeneralRe: Radio Buttons [modified] Pin
enhzflep31-Dec-09 19:41
enhzflep31-Dec-09 19:41 
Blush | :O
No need to apologize - (not for you anyway - sorry if I was unpleasant)


Yeah, I found php a bit interesting at first - but I found out that I could interface to COM objects so long as the server was running windows (linux xampps doesn't support COM objects, while the windows one does) This was of interest to me, because this means that you can create a website that (for example) that creates office documents based on user entered data, before making the custom and newly created document available for download. (word, excel, powerpoint, access etc)

But in my case, I had a desire to interface to a school/university timetabling program (syllabus+), that as luck would have it offered it's own com server. The massive advantage being that anyone could view a timetable so long as they had a network(or internet) accessible pc(or phone or ps3, etc). Thus freeing users from having to have the software installed on their machines.

Anyhow, the point is that with a large enough motivation I made a start with php back around August sometime(i forget), and have since gone on to write a reasonably functional pdf creation class in php. I realize that there are others available - many for free, though none did what I wanted AND were entirely free of copyright restrictions. I now have some code that will create (semi-optimized) pdfs, with images and attachments that runs under both windows and linux.

Without the help of others, I'd know very little. Shucks | :-\

Try this on for size:
"Poll Results.php"
<body>
<h3 style="color: rgb(255, 0, 0);">Poll Results</h3>
	<span style="color: rgb(255, 0, 0);">
	  <p>
		<?php
		   $choices = array("Firefox", "Chrome", "Navigator", "Safari", "Opera", "Internet Explorer");
		   $file = "votes.txt";
		   $total = 0;
		   $vote = $_POST["vote"];

		   print("You voted for: $vote<br>");

		   $handle = fopen($file,"a+");
		   $outStr = sprintf("%s\r\n", $vote);
		   fputs($handle, $outStr);
		   fclose($handle);
		   
		   $votes = file($file);
		   $i = 0;
		   $totals = array("Firefox"=>0, "Chrome"=>0, "Navigator"=>0, "Safari"=>0, "Opera"=>0, "Internet Explorer"=>0);
		   $ffx=0; $chr=0; $nav=0; $saf=0; $opr=0; $iex=0;
		   foreach ($votes as $curLine)
		   {
				if (!strcmp($curLine, "Firefox\r\n"))
					$ffx++;
				if (!strcmp($curLine, "Chrome\r\n"))
					$chr++;
				if (!strcmp($curLine, "Navigator\r\n"))
					$nav++;
				if (!strcmp($curLine, "Safari\r\n"))
					$saf++;
				if (!strcmp($curLine, "Opera\r\n"))
					$opr++;
				if (!strcmp($curLine, "Internet Explorer\r\n"))
					$iex++;
				$i++;	
		   }
	      printf("%s has %d votes<br>", $choices[0], $ffx);
	      printf("%s has %d votes<br>", $choices[1], $chr);
	      printf("%s has %d votes<br>", $choices[2], $nav);
	      printf("%s has %d votes<br>", $choices[3], $saf);
	      printf("%s has %d votes<br>", $choices[4], $opr);
	      printf("%s has %d votes<br>", $choices[5], $iex);
		?>
	  </p>
    </span>
    <p>Total: <?php echo $i; ?> votes.</p>
</body>


Produces an output of (after a few runs):

Poll Results


You voted for: Opera
Firefox has 0 votes
Chrome has 1 votes
Navigator has 0 votes
Safari has 1 votes
Opera has 1 votes
Internet Explorer has 0 votes

Total: 3 votes.



And creates a file "votes.txt" with the following content:
Chrome
Safari
Opera



Yeah, I know it's not particularly extensible nor neat - but hey look at the time of year - I never did program very well when drunk Laugh | :laugh:
GeneralRe: Radio Buttons Pin
thebiostyle31-Dec-09 21:44
thebiostyle31-Dec-09 21:44 
QuestionFind the differences betwween two arrays Pin
Marc Firth24-Dec-09 0:51
Marc Firth24-Dec-09 0:51 
AnswerRe: Find the differences betwween two arrays Pin
Luc Pattyn28-Dec-09 10:43
sitebuilderLuc Pattyn28-Dec-09 10:43 
QuestionHow to use postback in php Pin
sarang_k23-Dec-09 22:28
sarang_k23-Dec-09 22:28 
AnswerRe: How to use postback in php Pin
Marc Firth24-Dec-09 1:25
Marc Firth24-Dec-09 1:25 
Questionwarning message Pin
kamalesh574323-Dec-09 15:27
kamalesh574323-Dec-09 15:27 
AnswerRe: warning message Pin
Marc Firth24-Dec-09 1:27
Marc Firth24-Dec-09 1:27 
QuestionSTL vector trouble Pin
Daniel 'Tak' M.22-Dec-09 5:27
Daniel 'Tak' M.22-Dec-09 5:27 
Questionhelp with imap_search function Pin
cjoki21-Dec-09 7:08
cjoki21-Dec-09 7:08 
AnswerRe: help with imap_search function Pin
cjoki21-Dec-09 10:14
cjoki21-Dec-09 10:14 
QuestionPERL script help Pin
David Hoffman19-Dec-09 15:05
David Hoffman19-Dec-09 15:05 
AnswerRe: PERL script help Pin
David Hoffman19-Dec-09 21:45
David Hoffman19-Dec-09 21:45 
GeneralRe: PERL script help Pin
David Hoffman19-Dec-09 22:35
David Hoffman19-Dec-09 22:35 
GeneralRe: PERL script help Pin
Rob21-Dec-09 3:51
Rob21-Dec-09 3:51 
QuestionPHP script getting Gateway Timeout Error. Pin
LazyDragonfist19-Dec-09 8:09
LazyDragonfist19-Dec-09 8:09 
AnswerRe: PHP script getting Gateway Timeout Error. Pin
cjoki21-Dec-09 7:02
cjoki21-Dec-09 7:02 
QuestionHow Can I Start? Pin
code_breaker18-Dec-09 5:37
code_breaker18-Dec-09 5:37 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.