My background picture doesn't load if I have a selection statement on the page
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}
I am using a $_SESSION variable $_SESSION['EasyMode'] to decide if the background should be a solid color or a picture that looks like a field of grass. When a user logs in $_SESSION['EasyMode'] is set to true or false depending on the users preference. For some reason, I have to tell the program to first load the picture of the field and then if EasyMode is set to true then load the SolidBackground. If I don't load the picture of the field first, I simply get a white background.
Secondly, If I use a select statement for the user to input data, it always shows the background picture of the field regardless if EasyMode is true or false. On all my other web pages it displays correctly if there are no select statements and just HTML or other inputs. You can go to the website and register and see for yourself. When you register the last option allows you to set Easy Visual Mode to Yes or No and then you can always go back and change it by selecting Update Your Account.
Here is my code:
body {
background-image: url(assets/BlankField.jpg);
<?php
if ($_SESSION['EasyMode']) { ?>
background-image: url(assets/SolidBackground.png);
<?php
} ?>
}
<div id="ContentRight">
<form id="SelectUser" name="SelectUser" method="post" action="">
<table width="400" border="0" align="center">
<td><h6><span id="sprytextfield2">
<label for="Username"></label>
User Name
<br />
<?php
$sql = "SELECT * FROM users ORDER BY Username ASC ";
$result = mysql_query($sql);
// Make the first option blank
?>
<select name="Username" type="text" class="StyleTxtField">
<option></option>
<?php
while ($row = mysql_fetch_array($result)) {
?>
<option><?php echo $row['Username']; ?></option>
<?php
}
?>
<tr><br />
<td><input type="submit" name="Finduser" id="Finduser" value="Text Person" class="StyleTxtField"/></td>
</tr>
<tr>
</table></select>
</form>
</div>
background-image selection
add a comment |
I am using a $_SESSION variable $_SESSION['EasyMode'] to decide if the background should be a solid color or a picture that looks like a field of grass. When a user logs in $_SESSION['EasyMode'] is set to true or false depending on the users preference. For some reason, I have to tell the program to first load the picture of the field and then if EasyMode is set to true then load the SolidBackground. If I don't load the picture of the field first, I simply get a white background.
Secondly, If I use a select statement for the user to input data, it always shows the background picture of the field regardless if EasyMode is true or false. On all my other web pages it displays correctly if there are no select statements and just HTML or other inputs. You can go to the website and register and see for yourself. When you register the last option allows you to set Easy Visual Mode to Yes or No and then you can always go back and change it by selecting Update Your Account.
Here is my code:
body {
background-image: url(assets/BlankField.jpg);
<?php
if ($_SESSION['EasyMode']) { ?>
background-image: url(assets/SolidBackground.png);
<?php
} ?>
}
<div id="ContentRight">
<form id="SelectUser" name="SelectUser" method="post" action="">
<table width="400" border="0" align="center">
<td><h6><span id="sprytextfield2">
<label for="Username"></label>
User Name
<br />
<?php
$sql = "SELECT * FROM users ORDER BY Username ASC ";
$result = mysql_query($sql);
// Make the first option blank
?>
<select name="Username" type="text" class="StyleTxtField">
<option></option>
<?php
while ($row = mysql_fetch_array($result)) {
?>
<option><?php echo $row['Username']; ?></option>
<?php
}
?>
<tr><br />
<td><input type="submit" name="Finduser" id="Finduser" value="Text Person" class="StyleTxtField"/></td>
</tr>
<tr>
</table></select>
</form>
</div>
background-image selection
You can not put<tr><br /><td><input …>
inside a select field, that is massively invalid HTML.
– misorude
Nov 23 '18 at 7:56
I moved the </select> to immediately follow the while loop, but the result is no different.
– Robert
Nov 23 '18 at 9:59
Please edit the code in your question accordingly then. Also, make it make some sense to begin with - right now this is a mix of CSS and HTML that could not even work this way. And where is the code that puts the user’s choice into the session? Have you verified that works correct? Please show a proper Minimal, Complete, and Verifiable example.
– misorude
Nov 23 '18 at 10:07
I solved my problem. I forgot to add the command session_start() at the beginning of the page and therefore the the variable was always null. In addition to the syntax error in the statement.
– Robert
Nov 24 '18 at 4:53
add a comment |
I am using a $_SESSION variable $_SESSION['EasyMode'] to decide if the background should be a solid color or a picture that looks like a field of grass. When a user logs in $_SESSION['EasyMode'] is set to true or false depending on the users preference. For some reason, I have to tell the program to first load the picture of the field and then if EasyMode is set to true then load the SolidBackground. If I don't load the picture of the field first, I simply get a white background.
Secondly, If I use a select statement for the user to input data, it always shows the background picture of the field regardless if EasyMode is true or false. On all my other web pages it displays correctly if there are no select statements and just HTML or other inputs. You can go to the website and register and see for yourself. When you register the last option allows you to set Easy Visual Mode to Yes or No and then you can always go back and change it by selecting Update Your Account.
Here is my code:
body {
background-image: url(assets/BlankField.jpg);
<?php
if ($_SESSION['EasyMode']) { ?>
background-image: url(assets/SolidBackground.png);
<?php
} ?>
}
<div id="ContentRight">
<form id="SelectUser" name="SelectUser" method="post" action="">
<table width="400" border="0" align="center">
<td><h6><span id="sprytextfield2">
<label for="Username"></label>
User Name
<br />
<?php
$sql = "SELECT * FROM users ORDER BY Username ASC ";
$result = mysql_query($sql);
// Make the first option blank
?>
<select name="Username" type="text" class="StyleTxtField">
<option></option>
<?php
while ($row = mysql_fetch_array($result)) {
?>
<option><?php echo $row['Username']; ?></option>
<?php
}
?>
<tr><br />
<td><input type="submit" name="Finduser" id="Finduser" value="Text Person" class="StyleTxtField"/></td>
</tr>
<tr>
</table></select>
</form>
</div>
background-image selection
I am using a $_SESSION variable $_SESSION['EasyMode'] to decide if the background should be a solid color or a picture that looks like a field of grass. When a user logs in $_SESSION['EasyMode'] is set to true or false depending on the users preference. For some reason, I have to tell the program to first load the picture of the field and then if EasyMode is set to true then load the SolidBackground. If I don't load the picture of the field first, I simply get a white background.
Secondly, If I use a select statement for the user to input data, it always shows the background picture of the field regardless if EasyMode is true or false. On all my other web pages it displays correctly if there are no select statements and just HTML or other inputs. You can go to the website and register and see for yourself. When you register the last option allows you to set Easy Visual Mode to Yes or No and then you can always go back and change it by selecting Update Your Account.
Here is my code:
body {
background-image: url(assets/BlankField.jpg);
<?php
if ($_SESSION['EasyMode']) { ?>
background-image: url(assets/SolidBackground.png);
<?php
} ?>
}
<div id="ContentRight">
<form id="SelectUser" name="SelectUser" method="post" action="">
<table width="400" border="0" align="center">
<td><h6><span id="sprytextfield2">
<label for="Username"></label>
User Name
<br />
<?php
$sql = "SELECT * FROM users ORDER BY Username ASC ";
$result = mysql_query($sql);
// Make the first option blank
?>
<select name="Username" type="text" class="StyleTxtField">
<option></option>
<?php
while ($row = mysql_fetch_array($result)) {
?>
<option><?php echo $row['Username']; ?></option>
<?php
}
?>
<tr><br />
<td><input type="submit" name="Finduser" id="Finduser" value="Text Person" class="StyleTxtField"/></td>
</tr>
<tr>
</table></select>
</form>
</div>
background-image selection
background-image selection
asked Nov 23 '18 at 7:34
RobertRobert
1
1
You can not put<tr><br /><td><input …>
inside a select field, that is massively invalid HTML.
– misorude
Nov 23 '18 at 7:56
I moved the </select> to immediately follow the while loop, but the result is no different.
– Robert
Nov 23 '18 at 9:59
Please edit the code in your question accordingly then. Also, make it make some sense to begin with - right now this is a mix of CSS and HTML that could not even work this way. And where is the code that puts the user’s choice into the session? Have you verified that works correct? Please show a proper Minimal, Complete, and Verifiable example.
– misorude
Nov 23 '18 at 10:07
I solved my problem. I forgot to add the command session_start() at the beginning of the page and therefore the the variable was always null. In addition to the syntax error in the statement.
– Robert
Nov 24 '18 at 4:53
add a comment |
You can not put<tr><br /><td><input …>
inside a select field, that is massively invalid HTML.
– misorude
Nov 23 '18 at 7:56
I moved the </select> to immediately follow the while loop, but the result is no different.
– Robert
Nov 23 '18 at 9:59
Please edit the code in your question accordingly then. Also, make it make some sense to begin with - right now this is a mix of CSS and HTML that could not even work this way. And where is the code that puts the user’s choice into the session? Have you verified that works correct? Please show a proper Minimal, Complete, and Verifiable example.
– misorude
Nov 23 '18 at 10:07
I solved my problem. I forgot to add the command session_start() at the beginning of the page and therefore the the variable was always null. In addition to the syntax error in the statement.
– Robert
Nov 24 '18 at 4:53
You can not put
<tr><br /><td><input …>
inside a select field, that is massively invalid HTML.– misorude
Nov 23 '18 at 7:56
You can not put
<tr><br /><td><input …>
inside a select field, that is massively invalid HTML.– misorude
Nov 23 '18 at 7:56
I moved the </select> to immediately follow the while loop, but the result is no different.
– Robert
Nov 23 '18 at 9:59
I moved the </select> to immediately follow the while loop, but the result is no different.
– Robert
Nov 23 '18 at 9:59
Please edit the code in your question accordingly then. Also, make it make some sense to begin with - right now this is a mix of CSS and HTML that could not even work this way. And where is the code that puts the user’s choice into the session? Have you verified that works correct? Please show a proper Minimal, Complete, and Verifiable example.
– misorude
Nov 23 '18 at 10:07
Please edit the code in your question accordingly then. Also, make it make some sense to begin with - right now this is a mix of CSS and HTML that could not even work this way. And where is the code that puts the user’s choice into the session? Have you verified that works correct? Please show a proper Minimal, Complete, and Verifiable example.
– misorude
Nov 23 '18 at 10:07
I solved my problem. I forgot to add the command session_start() at the beginning of the page and therefore the the variable was always null. In addition to the syntax error in the statement.
– Robert
Nov 24 '18 at 4:53
I solved my problem. I forgot to add the command session_start() at the beginning of the page and therefore the the variable was always null. In addition to the syntax error in the statement.
– Robert
Nov 24 '18 at 4:53
add a comment |
1 Answer
1
active
oldest
votes
The proper code is as follows:
<style type="text/css">
<?php
include_once('includes/nfl6pack.inc.php');
session_start();
if ($_SESSION['EasyMode']) {
$attribute = 'assets/SolidBackground.png';
} else {
$attribute = 'assets/BlankField.jpg';
}
?>
body {
background-image: url(<?php echo $attribute; ?>);
}
</style>
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53442401%2fmy-background-picture-doesnt-load-if-i-have-a-selection-statement-on-the-page%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
The proper code is as follows:
<style type="text/css">
<?php
include_once('includes/nfl6pack.inc.php');
session_start();
if ($_SESSION['EasyMode']) {
$attribute = 'assets/SolidBackground.png';
} else {
$attribute = 'assets/BlankField.jpg';
}
?>
body {
background-image: url(<?php echo $attribute; ?>);
}
</style>
add a comment |
The proper code is as follows:
<style type="text/css">
<?php
include_once('includes/nfl6pack.inc.php');
session_start();
if ($_SESSION['EasyMode']) {
$attribute = 'assets/SolidBackground.png';
} else {
$attribute = 'assets/BlankField.jpg';
}
?>
body {
background-image: url(<?php echo $attribute; ?>);
}
</style>
add a comment |
The proper code is as follows:
<style type="text/css">
<?php
include_once('includes/nfl6pack.inc.php');
session_start();
if ($_SESSION['EasyMode']) {
$attribute = 'assets/SolidBackground.png';
} else {
$attribute = 'assets/BlankField.jpg';
}
?>
body {
background-image: url(<?php echo $attribute; ?>);
}
</style>
The proper code is as follows:
<style type="text/css">
<?php
include_once('includes/nfl6pack.inc.php');
session_start();
if ($_SESSION['EasyMode']) {
$attribute = 'assets/SolidBackground.png';
} else {
$attribute = 'assets/BlankField.jpg';
}
?>
body {
background-image: url(<?php echo $attribute; ?>);
}
</style>
answered Nov 24 '18 at 4:59
RobertRobert
1
1
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53442401%2fmy-background-picture-doesnt-load-if-i-have-a-selection-statement-on-the-page%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
You can not put
<tr><br /><td><input …>
inside a select field, that is massively invalid HTML.– misorude
Nov 23 '18 at 7:56
I moved the </select> to immediately follow the while loop, but the result is no different.
– Robert
Nov 23 '18 at 9:59
Please edit the code in your question accordingly then. Also, make it make some sense to begin with - right now this is a mix of CSS and HTML that could not even work this way. And where is the code that puts the user’s choice into the session? Have you verified that works correct? Please show a proper Minimal, Complete, and Verifiable example.
– misorude
Nov 23 '18 at 10:07
I solved my problem. I forgot to add the command session_start() at the beginning of the page and therefore the the variable was always null. In addition to the syntax error in the statement.
– Robert
Nov 24 '18 at 4:53