Omnimaga
General Discussion => Technology and Development => Web Programming and Design => Topic started by: flyingfisch on June 14, 2012, 08:58:27 pm
-
OK, having a problem with PHP.
Here is the code i have:
<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
-
Your problem is the line <?PHP echo "upload.php?" . $_POST["formSelect"]) ?> in line 6. Unmatched right paren.
-
That parentheses must be a semicolon.
-
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.
<?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>"
}
?>
-
if ($domain_name != "newdomain.com" || $domain_name != "www.newdomain.com")
->
if ($domain_name != "newdomain.com" && $domain_name != "www.newdomain.com")
-
Oh, oh, ok. I was getting mixed up. I was thinking I needed to use "or".