Author Topic: PHP question  (Read 2757 times)

0 Members and 1 Guest are viewing this topic.

Offline flyingfisch

  • I'm 1337 now!
  • Members
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1620
  • Rating: +94/-17
  • Testing, testing, 1...2...3...4...5...6...7...8..9
    • View Profile
    • Top Page Website Design
PHP question
« on: June 14, 2012, 08:58:27 pm »
OK, having a problem with PHP.

Here is the code i have:

Code: [Select]
<select name="formSelect">
<option value="value1">value1</option>
<option value="value2">value2</option>
</select>

<form action= "<?PHP echo "upload.php?" . $_POST["formSelect"]) ?>" method="post" enctype="multipart/form-data">
<label for="file">Filename:</label>
<input type="file" name="userfile" id="file" />
<br />
<input type="submit" name="submit" value="Submit" />
</form>

And its not working.

What I want it to do is make the form action equal upload.php?formSelectvalue .

Can anyone help?

EDIT:

Fixed it by putting <select> inside the <form> tags
« Last Edit: June 14, 2012, 09:15:56 pm by flyingfisch »



Quote from: my dad
"welcome to the world of computers, where everything seems to be based on random number generators"



The Game V. 2.0

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: PHP question
« Reply #1 on: June 14, 2012, 09:48:15 pm »
Your problem is the line <?PHP echo "upload.php?" . $_POST["formSelect"]) ?> in line 6. Unmatched right paren.




Offline Sorunome

  • Fox Fox Fox Fox Fox Fox Fox!
  • Support Staff
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 7920
  • Rating: +374/-13
  • Derpy Hooves
    • View Profile
    • My website! (You might lose the game)
Re: PHP question
« Reply #2 on: June 15, 2012, 10:38:52 am »
That parentheses must be a semicolon.

THE GAME
Also, check out my website
If OmnomIRC is screwed up, blame me!
Click here to give me an internet!

Offline flyingfisch

  • I'm 1337 now!
  • Members
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1620
  • Rating: +94/-17
  • Testing, testing, 1...2...3...4...5...6...7...8..9
    • View Profile
    • Top Page Website Design
Re: PHP question
« Reply #3 on: June 18, 2012, 12:23:57 pm »
I have another question now.

This code should tell users to go to the new domain name, only if the domain name is not the new one.

Instead it displays it all the time.

Code: [Select]
<?PHP
$domain_name = $_SERVER['HTTP_HOST'];

if ($domain_name != "newdomain.com" || $domain_name != "www.newdomain.com") {
   echo "<p>We have a new domain name! <a href="newdomain.com">Click Here!</a></p>"
}
?>



Quote from: my dad
"welcome to the world of computers, where everything seems to be based on random number generators"



The Game V. 2.0

Offline Sorunome

  • Fox Fox Fox Fox Fox Fox Fox!
  • Support Staff
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 7920
  • Rating: +374/-13
  • Derpy Hooves
    • View Profile
    • My website! (You might lose the game)
Re: PHP question
« Reply #4 on: June 18, 2012, 12:42:38 pm »
if ($domain_name != "newdomain.com" || $domain_name != "www.newdomain.com")
->
if ($domain_name != "newdomain.com" && $domain_name != "www.newdomain.com")

THE GAME
Also, check out my website
If OmnomIRC is screwed up, blame me!
Click here to give me an internet!

Offline flyingfisch

  • I'm 1337 now!
  • Members
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1620
  • Rating: +94/-17
  • Testing, testing, 1...2...3...4...5...6...7...8..9
    • View Profile
    • Top Page Website Design
Re: PHP question
« Reply #5 on: June 18, 2012, 12:52:50 pm »
Oh, oh, ok. I was getting mixed up. I was thinking I needed to use "or".



Quote from: my dad
"welcome to the world of computers, where everything seems to be based on random number generators"



The Game V. 2.0