Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
Donations
Please Support Us!

Please help keep (=WDG=) alive

Donate with PayPal!
Last 100 Shouts:
January 16, 2025, 08:56:20 PM
Happy New Year!
January 27, 2024, 05:26:45 PM
Happy new year WDG
December 10, 2023, 05:52:39 PM
Hello Power!
November 24, 2023, 09:51:34 PM
Helloes! I'm here for my annual password change! How is everyone doing?
August 03, 2023, 08:42:51 PM
WDG are going to i71. All welcome. Message for more information or ask on discord
July 27, 2023, 07:35:21 PM
The WDG discord channel is up and running. Send me a message or post for details
December 08, 2022, 04:05:12 PM
Odd. Should do. Send Mode a messsage here. He should be able to pick it up and send you an invite
December 07, 2022, 11:26:55 PM
@berath link doesn?t work Sad
August 08, 2022, 09:32:46 PM
December 23, 2020, 12:34:53 PM
Spammers be gone!
September 28, 2020, 11:18:57 PM
Nice!
September 28, 2020, 09:55:06 PM
I’m in 🙌
September 28, 2020, 02:59:45 PM
Yay!!!!!! Wix is in da house
September 28, 2020, 02:55:44 PM
Hey Berath !! I made it !
September 25, 2020, 05:13:56 PM
Wix - we may have some new friends playing a new game finding their way here soon.....
July 01, 2020, 11:05:23 PM
Hello Terror. People still drop by here now and again
June 29, 2020, 02:02:45 PM
Hi guys. I hope you are all well and keeping sane and safe during these trying times (and all that).

Just FYI that mode was looking for ways to get back in touch via reddit (r/WDG).
February 24, 2020, 09:26:46 AM
Zombie TF2? Do we need to dress up?
February 19, 2020, 01:03:56 AM
I'd play zombie TF2
February 19, 2020, 12:52:19 AM
Any appetite for a TF2 revival?
February 19, 2020, 12:52:01 AM
Awesome
February 19, 2020, 12:48:30 AM
Yes this thing is still on
February 19, 2020, 12:47:16 AM
Hello! Is this thing still on?
December 26, 2019, 12:43:10 AM
Merry Christmas!!!
August 13, 2019, 07:35:11 PM
Sweeping and clearing out the cobwebs, keeping everything spruce https://gph.is/2oImD0j
March 08, 2019, 11:38:14 AM
Cheers Stu / Berath was going to happen one day Sad
March 06, 2019, 11:08:46 PM
It's officially 'not secure' according to Chrome now
March 06, 2019, 11:07:11 PM
Damn. 1&1 have upgraded their something or other but seem to have allowed for ancient forums like this to keep on
March 05, 2019, 03:37:50 PM
NuB site is no more due to a forced PHP v7 upgrade on the web host that breaks SMF/TinyPortal.
January 31, 2019, 09:50:48 AM
Sad
January 22, 2019, 11:22:09 PM
Sad nub  site down Sad bye bye

January 01, 2019, 11:43:02 AM
Happy new year.
Who Dares... Grins!!
December 30, 2018, 08:04:52 PM
no
December 29, 2018, 12:05:55 PM
MEssaage me
for a free steam key for faeria
December 25, 2018, 02:35:39 PM
merry xmas wdg
December 23, 2018, 11:34:33 AM
Hello Milli!
December 21, 2018, 10:55:25 PM
Hello WDG!
December 13, 2018, 10:51:13 PM
I still pop by to give the old place a dusting and clear out
November 09, 2018, 03:36:17 PM
The shoutbox has actually had shouts in it recently? Impossible.
November 08, 2018, 07:45:58 PM
:dohjan: :newkid:
November 06, 2018, 07:11:48 PM
Enjoy!
November 05, 2018, 11:49:05 PM
Just poking about
June 02, 2018, 12:56:39 PM
Goodness me, so it does!
May 22, 2018, 03:38:35 PM
this site needs a shout in 2018 Smiley
November 16, 2017, 08:08:43 PM
Spam removed. Thank you muchly Hulinut
October 15, 2017, 06:02:47 PM
Yay, been fixed!
October 14, 2017, 07:08:12 PM
I'm trying to get the mumble server up again
October 11, 2017, 06:23:26 PM
Orange Box 10 years old wow
June 18, 2017, 09:46:41 PM
Fluffy!
June 14, 2017, 03:14:35 PM
:p
May 30, 2017, 10:14:48 PM
Hmph. Spammers!
April 19, 2017, 08:20:44 PM
Also - hai!
April 19, 2017, 08:20:38 PM
Just in case no-one saw it - I posted about i61 over on the wdg-reddit!
April 17, 2017, 02:18:03 PM
April 16, 2017, 12:28:45 PM
Don't mind me, just helping Berath clean up the dust
April 04, 2017, 09:46:13 PM
Mumble server down: I've submitted a ticket
March 13, 2017, 01:20:32 AM
It is. Sleeping
March 11, 2017, 06:24:54 PM
so quiet
December 06, 2016, 03:10:39 PM
Every day or so I drop by to empty out the logs, dust down the furniture and shake out the curtains
November 04, 2016, 05:15:57 PM
How's tricks WDG?
November 02, 2016, 10:36:32 PM
Yay CruelCow!!
November 01, 2016, 08:17:40 PM
Yeah, I still check here regularly
November 01, 2016, 06:16:46 PM
Forum is back up after I did some tinkering. Did anyone notice it was down?!?
September 03, 2016, 05:48:48 PM
Thanks for offering but platformers = frustration for me. All that jumping about and getting impaled
September 03, 2016, 10:54:37 AM
Does anyone want a 75%off coupon for Feist?
July 09, 2016, 02:56:39 PM
I knew you were behind them!
July 08, 2016, 11:40:05 AM
What the fucking hell is all this shit?

You'll be blaming me for shit Tf2 updates next!
July 06, 2016, 11:35:09 PM
Therefore, Lefty is indeed responsible
July 06, 2016, 10:56:20 PM
Wales voted Leave
June 25, 2016, 05:30:56 PM
Well he *is* called Leftism
June 24, 2016, 07:36:47 PM
I'm going to completely unjustifiably hold Lefty to blame for the Brexit.
That is all.
June 05, 2016, 01:56:52 PM
Woop woop i58 ticket bought!
May 13, 2016, 06:08:28 PM
I want that game
May 07, 2016, 10:20:36 PM
its not optimized well just like the ps4 version
May 07, 2016, 09:01:50 PM
why does everyone's gone rapture run like doggegg on my pc
April 13, 2016, 05:18:58 PM
Just to really bang it home. WDG sub-reddit here: https://www.reddit.com/r/WDG/
April 06, 2016, 10:06:39 AM
Thank you Smiley
April 04, 2016, 04:24:56 PM
Just send you one.
April 04, 2016, 10:48:17 AM
If there are any still going, I'll have one
April 02, 2016, 11:47:32 AM
i have beta passes if anyone wants them as well
March 23, 2016, 12:18:40 PM
If anybody wants a tf2 competetive beta pass, i have a spare.
March 18, 2016, 12:18:46 PM
It's too expensive Sad
March 15, 2016, 03:24:04 PM
Will you all go buy The Division now so I have someone to play with? Smiley
March 11, 2016, 08:32:56 PM
FIREWATCH
March 11, 2016, 07:56:09 PM
March 11, 2016, 07:56:08 PM
March 02, 2016, 06:02:38 PM
some of the stealth sections are a bit of a drag, but they're not as bad as the VIP escort missions in THE VITNESS
March 02, 2016, 12:06:23 PM
Easy with the spoilers, guys! I'm still  on the blunderbuss part.
March 01, 2016, 09:17:32 PM
Can't believe Henry managed to use his NAVY Seal experience to defuse the bomb that was strapped to the bear in the end
March 01, 2016, 03:38:29 PM
I just unlocked the rifle scope in firewatch, makes it much easier to pick off bears before they get into melee range
March 01, 2016, 12:34:14 PM
FIREWATCH
March 01, 2016, 12:13:37 PM
I can't believe GAMERS don't like the witness. It's the MOST GAMER game EVER.
February 29, 2016, 12:08:32 PM
Its overrated. Now FIREWATCH on the other side...
February 29, 2016, 11:21:43 AM
I got the basic ending in the witness and it was B A D
February 22, 2016, 10:58:37 AM
I have no understanding of the environmental puzzles
February 22, 2016, 10:58:25 AM
Every so often someone says something about "environmental puzzles" in the witness and I skip it because of spoilers
February 15, 2016, 01:02:48 AM
press x to exercise 5th freedom
February 14, 2016, 11:53:36 AM
My game came with an EXCLUSIVE PREORDER CODE for the Chaos Theory suit, shoulda preordered DUH
February 14, 2016, 02:02:52 AM
i want the super stealth suit.

I go lethal on grim missions
Calendar
October 2025
MoTuWeThFrSaSu
12345
6789101112
13141516171819
20212223242526
2728293031

Birthdays
Chaos (40)

Upcoming Events
Upcoming Birthdays: Chaos (40)
Members
Total Members: 311
Latest: BuildersIslington
Stats
Total Posts: 129727
Total Topics: 3983
Online Today: 58
Online Ever: 555
(October 08, 2025, 07:43:27 PM)
Users Online
Users: 0
Guests: 18
Total: 18
Pages: [1]
Print
Author Topic: PHP problem  (Read 8017 times)
0 Members and 1 Guest are viewing this topic.
Mosch
Guest
« on: September 23, 2008, 03:11:00 PM »

Any of you guys know php? I'm supposed to fix something but can't find the problem. I have never used php before (I don't do web pages and usually program in C++) and the source I was given seems OK to my untrained eye... here it is:

Code:
<form action="HProbe.php" method="post">
  <table><tr>
<?php
if ($_POST['lieder'] == '1') {echo '<td colspan=2><CENTER><embed type ="audio/mpg" src="audio/John.mp3" autostart="yes" id="player" /></CENTER></td>'}
else if (
$_POST['lieder'] == '2') {echo '<td colspan=2><CENTER><embed type ="audio/mpg" src="audio/Gospell.mp3" autostart="yes" id="player" /></CENTER></td>'}
else if (
$_POST['lieder'] == '3') {echo '<td colspan=2><CENTER><embed type ="audio/mpg" src="audio/Boogie.mp3" autostart="yes" id="player" /></CENTER></td>'}
else if (
$_POST['lieder'] == '4') {echo '<td colspan=2><CENTER><embed type ="audio/mpg" src="audio/Time.mp3" autostart="yes" id="player" /></CENTER></td>'}
else if (
$_POST['lieder'] == '5') {echo '<td colspan=2><CENTER><embed type ="audio/mpg" src="audio/Stella.mp3" autostart="yes" id="player" /></CENTER></td>'}
else if (
$_POST['lieder'] == '6') {echo '<td colspan=2><CENTER><embed type ="audio/mpg" src="audio/Danny.mp3" autostart="yes" id="player" /></CENTER></td>'}
else if (
$_POST['lieder'] == '7') {echo '<td colspan=2><CENTER><embed type ="audio/mpg" src="audio/Mondschein.mp3" autostart="yes" id="player" /></CENTER></td>'}
else if (
$_POST['lieder'] == '8') {echo '<td colspan=2><CENTER><embed type ="audio/mpg" src="audio/Elise.mp3" autostart="yes" id="player" /></CENTER></td>'}
else if (
$_POST['lieder'] == '9') {echo '<td colspan=2><CENTER><embed type ="audio/mpg" src="audio/Bach.mp3" autostart="yes" id="player" /></CENTER></td>'}
else if (
$_POST['lieder'] == '10') {echo '<td colspan=2><CENTER><embed type ="audio/mpg" src="audio/Blue.mp3" autostart="yes" id="player" /></CENTER></td>'}
else if (
$_POST['lieder'] == '11') {echo '<td colspan=2><CENTER><embed type ="audio/mpg" src="audio/Help.mp3" autostart="yes" id="player" /></CENTER></td>'}
else if (
$_POST['lieder'] == '12') {echo '<td colspan=2><CENTER><embed type ="audio/mpg" src="audio/Dirge.mp3" autostart="yes" id="player" /></CENTER></td>'}
else {echo 
'<td colspan=2><CENTER><embed type ="audio/mpg" src="audio/John.mp3" autostart="yes" id="player" /></CENTER></td>'}
?>

  </tr>

  <td>
  <p>
    <select id="liedCh" name="lieder">
      <option value="1">Blues</option>
      <option value="2">Gospel</option>
      <option value="3">Boogie</option>
      <option value="4">As time goes by</option>
      <option value="5">Jazzpiano</option>
<option value="6">Danny boy</option>
<option value="7">Mondscheinsonate</option>
<option value="8">F&uuml;r Elise</option>
<option value="9">Pr&auml;ludium</option>
<option value="10">Jazzpiano 2</option>
<option value="11">Pop-Piano</option>
<option value="12">Blues in G-Moll</option>
    </select>
  </p>
  </td>
  <td>
  <p>
  <input type="submit" value="Lied abspielen">
  </p>
  </td>
  </tr></table>
</form>

The file is called HProbe.php by the way, so it calls itself.

By the way, the problem is that every single file gets loaded and cosequently crashes the browser.
Logged
DeadlyAvenger
Ex-Leader
Donator
*

Karma: 1265
Offline Offline

Gender: Male
Posts: 5291


Spam, Egg, Sausage, Chips and Spam


WWW
« Reply #1 on: September 23, 2008, 03:19:37 PM »

Looks like it's because you havn't put a semicolon at the end of each line.

PHP requires each statement to end with a semicolon. The code below works Smiley

Code:
<form action="HProbe.php" method="post">
  <table><tr>
<?php
if ($_POST['lieder'] == '1') {echo '<td colspan=2><CENTER><embed type ="audio/mpg" src="audio/John.mp3" autostart="yes" id="player" /></CENTER></td>';}
else if (
$_POST['lieder'] == '2') {echo '<td colspan=2><CENTER><embed type ="audio/mpg" src="audio/Gospell.mp3" autostart="yes" id="player" /></CENTER></td>';}
else if (
$_POST['lieder'] == '3') {echo '<td colspan=2><CENTER><embed type ="audio/mpg" src="audio/Boogie.mp3" autostart="yes" id="player" /></CENTER></td>';}
else if (
$_POST['lieder'] == '4') {echo '<td colspan=2><CENTER><embed type ="audio/mpg" src="audio/Time.mp3" autostart="yes" id="player" /></CENTER></td>';}
else if (
$_POST['lieder'] == '5') {echo '<td colspan=2><CENTER><embed type ="audio/mpg" src="audio/Stella.mp3" autostart="yes" id="player" /></CENTER></td>';}
else if (
$_POST['lieder'] == '6') {echo '<td colspan=2><CENTER><embed type ="audio/mpg" src="audio/Danny.mp3" autostart="yes" id="player" /></CENTER></td>';}
else if (
$_POST['lieder'] == '7') {echo '<td colspan=2><CENTER><embed type ="audio/mpg" src="audio/Mondschein.mp3" autostart="yes" id="player" /></CENTER></td>';}
else if (
$_POST['lieder'] == '8') {echo '<td colspan=2><CENTER><embed type ="audio/mpg" src="audio/Elise.mp3" autostart="yes" id="player" /></CENTER></td>';}
else if (
$_POST['lieder'] == '9') {echo '<td colspan=2><CENTER><embed type ="audio/mpg" src="audio/Bach.mp3" autostart="yes" id="player" /></CENTER></td>';}
else if (
$_POST['lieder'] == '10') {echo '<td colspan=2><CENTER><embed type ="audio/mpg" src="audio/Blue.mp3" autostart="yes" id="player" /></CENTER></td>';}
else if (
$_POST['lieder'] == '11') {echo '<td colspan=2><CENTER><embed type ="audio/mpg" src="audio/Help.mp3" autostart="yes" id="player" /></CENTER></td> ';}
else if (
$_POST['lieder'] == '12') {echo '<td colspan=2><CENTER><embed type ="audio/mpg" src="audio/Dirge.mp3" autostart="yes" id="player" /></CENTER></td>'; }
else {echo 
'<td colspan=2><CENTER><embed type ="audio/mpg" src="audio/John.mp3" autostart="yes" id="player" /></CENTER></td>';}
?>

  </tr>

  <td>
  <p>
    <select id="liedCh" name="lieder">
      <option value="1">Blues</option>
      <option value="2">Gospel</option>
      <option value="3">Boogie</option>
      <option value="4">As time goes by</option>
      <option value="5">Jazzpiano</option>
<option value="6">Danny boy</option>
<option value="7">Mondscheinsonate</option>
<option value="8">F&uuml;r Elise</option>
<option value="9">Pr&auml;ludium</option>
<option value="10">Jazzpiano 2</option>
<option value="11">Pop-Piano</option>
<option value="12">Blues in G-Moll</option>
    </select>
  </p>
  </td>
  <td>
  <p>
  <input type="submit" value="Lied abspielen">
  </p>
  </td>
  </tr></table>
</form>

« Last Edit: September 23, 2008, 03:23:23 PM by deadlyavenger » Logged

Mosch
Guest
« Reply #2 on: September 23, 2008, 03:46:56 PM »

Thanks, but unfortunately no, it does not work. The very same problem still occurs.
Logged
Alex
Guest
« Reply #3 on: September 23, 2008, 03:57:48 PM »

Try this. I didn't have time to test it.
Code:

<?php
switch ($_POST['lieder']){
case 1: echo '<td colspan=2><CENTER><embed type ="audio/mpg" src="audio/John.mp3" autostart="yes" id="player" /></CENTER></td>'; break;
case 2: echo '<td colspan=2><CENTER><embed type ="audio/mpg" src="audio/Gospell.mp3" autostart="yes" id="player" /></CENTER></td>'; break;
case 3: echo '<td colspan=2><CENTER><embed type ="audio/mpg" src="audio/Boogie.mp3" autostart="yes" id="player" /></CENTER></td>'; break;
case 4: echo '<td colspan=2><CENTER><embed type ="audio/mpg" src="audio/Time.mp3" autostart="yes" id="player" /></CENTER></td>'; break;
case 5: echo '<td colspan=2><CENTER><embed type ="audio/mpg" src="audio/Stella.mp3" autostart="yes" id="player" /></CENTER></td>'; break;
case 6: echo '<td colspan=2><CENTER><embed type ="audio/mpg" src="audio/Danny.mp3" autostart="yes" id="player" /></CENTER></td>'; break;
case 7: echo '<td colspan=2><CENTER><embed type ="audio/mpg" src="audio/Mondschein.mp3" autostart="yes" id="player" /></CENTER></td>'; break;
case 8: echo '<td colspan=2><CENTER><embed type ="audio/mpg" src="audio/Elise.mp3" autostart="yes" id="player" /></CENTER></td>'; break;
case 9: echo '<td colspan=2><CENTER><embed type ="audio/mpg" src="audio/Bach.mp3" autostart="yes" id="player" /></CENTER></td>'; break;
case 10: echo '<td colspan=2><CENTER><embed type ="audio/mpg" src="audio/Blue.mp3" autostart="yes" id="player" /></CENTER></td>'; break;
case 11: echo '<td colspan=2><CENTER><embed type ="audio/mpg" src="audio/Help.mp3" autostart="yes" id="player" /></CENTER></td>'; break;
case 12: echo '<td colspan=2><CENTER><embed type ="audio/mpg" src="audio/Dirge.mp3" autostart="yes" id="player" /></CENTER></td>'; break;
echo '<td colspan=2><CENTER><embed type ="audio/mpg" src="audio/John.mp3" autostart="yes" id="player" /></CENTER></td>';
}
?>


Logged
Mosch
Guest
« Reply #4 on: September 23, 2008, 04:04:33 PM »

Lieder saves strings, not integers, but I get the idea. By the way: Does php not use a default: case when switching? Or, more to the point, is it enough to just put the default operation without declaring this the default case?

And thanks again, I'll try it later Wink
Logged
DeadlyAvenger
Ex-Leader
Donator
*

Karma: 1265
Offline Offline

Gender: Male
Posts: 5291


Spam, Egg, Sausage, Chips and Spam


WWW
« Reply #5 on: September 23, 2008, 04:07:43 PM »

That's weird, the version I used above worked fine on my test rig running on my pc.

It doesn't matter if it's a string or integer in PHP, there is no variable definition and PHP just 'guesses' the appropriate type and can change type on the fly.

But the above code should work too.
« Last Edit: September 23, 2008, 04:09:38 PM by deadlyavenger » Logged

Alex
Guest
« Reply #6 on: September 23, 2008, 04:09:06 PM »

For strings, just add "" (case "1": ), but php usually converts to int if the string is one.
In php, the default case can be declared with
Code:
default: echo "yourstuff";
but I think it works without as well.

Also, if you look for help with php, always try "php.net/yoursearch", in this case php.net/switch.

Also, echo $_POST['lieder'] at the beginning just to make sure your server doesn't screw things up somehow.
« Last Edit: September 23, 2008, 04:16:05 PM by Alex » Logged
Mosch
Guest
« Reply #7 on: September 23, 2008, 05:36:05 PM »

Problem solved. It was not the code at all - the hoster just needed confirmation to activate PHP. Why? I have no freaking idea. I found out about that one when I, frustrated and pissed off, installed an apache server and PHP on my own PC, just for this single php file. Lo and behold, the code you guys gave me worked like a charm and a little call to the hosting provider cleared the rest up nicely. So now a local musician has a working homepage which he would like to express his thanks for.
Logged
r007
Supporting the Brits since 2008
Clan admin
****

Karma: 489
Offline Offline

Gender: Male
Posts: 1789


Bow before me, for I am root.


WWW
« Reply #8 on: September 23, 2008, 06:50:39 PM »

Lazy man's version (just need to modify the song array to add new ones...):

Code:
<?php
$lieder 
= array('John' => 'Blues',
                
'Gospell' => 'Gospel',
                
'Time' => 'As time goes by'
                
/* you get the idea */);

if (isset(
$_POST['lieder']) && isset($lieder[$_POST['lieder']]) ) { /* check if set and really a song */
    
echo  '<td colspan=2><CENTER><embed type ="audio/mpg" src="audio/'$lieder[$_POST['lieder']] . '.mp3" autostart="yes" id="player" /></CENTER></td>';
}


// -------------- now the selector -----------------
?>

<p>
    <select id="liedCh" name="lieder">
<?php
    
foreach ($lieder as $file => $title) {
         echo 
"<option value=\"$file\">$title</option>";
    }
?>

 </select>
</p>

just thought I should point this out to you, If you need to mess around with the page more often, make life easier for yourself. Cheesy
Logged


Ceterum censio RFC1855 esse legendam.
Junta
Guest
« Reply #9 on: September 24, 2008, 04:00:23 AM »

I hate PHP - had enough of it on this site tbh Sad
Logged
Gonk
Clan member
***

Karma: 52
Offline Offline

Posts: 320



« Reply #10 on: September 24, 2008, 09:01:41 AM »

wtf is PHP lol Smiley (dnt wanna know i reckon)
Logged



Junta
Guest
« Reply #11 on: September 24, 2008, 09:08:36 AM »

Its a programming language - popular for website creation

http://en.wikipedia.org/wiki/PHP
Logged
r007
Supporting the Brits since 2008
Clan admin
****

Karma: 489
Offline Offline

Gender: Male
Posts: 1789


Bow before me, for I am root.


WWW
« Reply #12 on: September 24, 2008, 09:35:31 AM »

I hate PHP - had enough of it on this site tbh Sad

Yeah, pretty much hate it too. It's okay for small websites but for serious development, the fact that it is not properly typed soon comes around and bites you in the ass. (Trust me, I speak from personal experience...)
You would want to do serious stuff in Java Enterprise, but that too is a pain in the arse, what with all the additional packages you need (templating, MVC framework, ugh...)

In short: Web development sucks balls.
Logged


Ceterum censio RFC1855 esse legendam.
Mosch
Guest
« Reply #13 on: September 24, 2008, 10:28:02 AM »

In short: Web development sucks balls.

Now that's a fact. I much prefer devving desktop applications myself, too.
Logged
Pages: [1]
Print
My CommunityForumPublicTechnicalTopic: PHP problem
Jump to:  


Who Dares... Grins UK TF2 Clan