I'm trying to set up a CSS page so the my PHP site has background and basics. However, the CSS doesn't show up, although direct style modifications to the HTML code work fine.
Here's the CSS:
body {
background-color: #FF9900;
}
h1 {
color: #6600FF;
font-family: "Arial Black", Gadget, sans-serif;
}
#passwd_result{
background:#FF9900;
color:#FFFFFF;
font-weight:bold;
margin-right:60%;
}
#upload_result{
background:#CC3300;
color:#FFFFFF;
font-weight:bold;
margin-right:60%;
}
And this is the index page with the CSS reference:
<html>
<head>
<link rel="stylesheet" type="text/css" href="css/default.css">
</head>
<body>
<?php
echo "<h1 align='center'> Welcome to Metube! </h1>";
?>
<form action="login.php" method="post" align="center">
<input type="submit" class="button" VALUE = "Log in" >
</form>
<form action="register.php" method="post" align="center">
<input type="submit" class="button" VALUE = "Register" >
</form>
</body>
</html>
Related
The below is the page where the user will enter their info and submit it to the PHP program
<!DOCTYPE html>
<html>
<head>
<title>Depreciation Calculator</title>
<link rel="stylesheet" type="text/css" href="main.css"/>
</head>
<body>
<div id="content">
<h1>Enter Your info</h1>
<form action="deprecalc.php" method="post">
<div id="data">
<label>Item name</label>
<input type="text" name="item_name"/>
<label>Purchase price</label>
<input type="text" name="purchase_price"/>
</br>
<label>No. of years</label>
<input type="text" name="no_of_years"/>
</br>
<label>Salvage value</label>
<input type="text" name="salvage_value"/>
</br>
</div>
<div id="buttons">
<label> </label>
<input type="submit" value="Calculate"></br>
</div>
</form>
</div>
</body>
</html>
And this is the page the data is being submitted to. My issue is where to define the variables needed to use this formula: Depreciation = (Purchase Price – Remaining Value) / Useful Life.
<?php
$item_name = $_POST['item_name'];
$purchase_price = $_POST['purchase_price'];
$no_of_years = $_POST['no_of_years'];
$salvage_value = $_POST['salvage_value'];
$remaining_value = $purchase_price - $depreciation;
$depreciation = ($purchase_price - $remaining_value) / $no_of_years;
?>
<!DOCTYPE html>
<html>
<head>
<title>Depreciation Calculator</title>
<link rel="stylesheet" type="text/css" href="main.css"/>
</head>
<body>
<div id="content">
<style>
#values {
font-family: Arial, Helvetica, sans-serif;
border-collapse: collapse;
width: 100%;
}
#values td, #values th {
border: 1px solid #ddd;
padding: 8px;
}
#values tr:nth-child(even){background-color: #f2f2f2;}
#values tr:hover {background-color: #ddd;}
#values th {
padding-top: 12px;
padding-bottom: 12px;
text-align: left;
background-color: navy;
color: white;
}
</style>
<body>
<h2>Item: <?php echo $item_name;?></h2></br>
<h2>Cost: <?php echo $purchase_price;?></h2></br>
<table id="values">
<tr>
<th>Year</th>
<th>Depreciation to date</th>
<th>Remaining value</th>
</tr>
<tr>
<?php
$i=1;
while ($i <= $no_of_years){
echo "<td>" . $i++ . "</td>";
}
?>
<?php
while ($remaining_value >= 0){
echo "<td>" . $depreciation . "</td>";
}
?>
<?php
while ($depreciation <= $purchase_price){
echo "<td>" . $remaining_value . "</td>";
}
?>
</tr>
</table>
</body>
</html>
</div>
</body>
</html>
I'm supposed to display it in a table format with the table heads being year, depreciation to data, and remaining value. When I run the above code, it simply outputs the year 1-5, followed by a never ending string of 0's, which I know means that it's stuck in a loop, and I've tried putting an endwhile at the end of each loop, but I then get this error:
Parse error: syntax error, unexpected token "endwhile", expecting end of file in C:\xampp\htdocs\deprecalc.php on line 68
I tried to make a class but it didn't work so I tried in style to make it hover but it doesn't work as well. How can I make the background color of the button change when I hover. Or how can I make a class in php?
<?php if (isset($_SESSION['uID'])) {
echo "<form action='includes/logout.inc.php' >
<button>LOG OUT </button>
</form>";
} else {
echo" <form action='includes/login.inc.php' method='POST'>
<input type='text' name='u_Email' placeholder='E-mail'> <br/>
<input type='password' name='uWachtwoord' placeholder='Wachtwoord'>
<button style='background-color:orange;color:white;border-width:0px;width:300px;height:50px;font-family:BerlinSansFB;font-size:30px;hover:background-color:black;' name='button' id='button' type='submit'>LOGIN</button>
</form>";
} ?>
Try this with internal css.
<style>
.button1 {
background-color: white;
color: black;
border: 2px solid #4CAF50;
}
.button1:hover {
background-color: #4CAF50;
color: white;
}
</style>
Give this class to your button and try it.
Thanks.
Move all those styles into a separate CSS file, and then use the :hover pseudo-class, like this:
button {
/* All those styles */
}
button:hover {
/* Stuff you want to override on hover. For example: */
background-color: #f00;
}
Have changed your code : add class name "login-button" for button
<?php if (isset($_SESSION['uID'])) {
echo "<form action='includes/logout.inc.php' >
<button>LOG OUT </button>
</form>";
} else {
echo" <form action='includes/login.inc.php' method='POST'>
<input type='text' name='u_Email' placeholder='E-mail'> <br/>
<input type='password' name='uWachtwoord' placeholder='Wachtwoord'>
<button class='login-button' name='button' id='button' type='submit'>LOGIN</button>
</form>";
} ?>
Put CSS :
.login-button { background-color:orange;color:white;border-width:0px;width:300px;height:50px;font-family:BerlinSansFB;font-size:30px; }
.login-button:hover { background-color:black; }
You will need to have a button:hover {} css styling that is separate from button {} styling.
It is better to separate the css from html.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<style media="screen">
button {
background-color:orange;
color:white;
border-width:0px;
width:300px;
height:50px;
font-family:BerlinSansFB;
font-size:30px;
}
button:hover {
background-color:black;
}
</style>
</head>
<body>
<?php if ( isset($_SESSION['uID']) ): ?>
<form action='includes/logout.inc.php' >
<button>LOG OUT </button>
</form>
<?php else: ?>
<form action='includes/login.inc.php' method='POST'>
<input type='text' name='u_Email' placeholder='E-mail'> <br/>
<input type='password' name='uWachtwoord' placeholder='Wachtwoord'>
<button name='button' id='button' type='submit'>LOGIN</button>
</form>
<?php endif ?>
</body>
</html>
I am developing an application in php and html in which the user must enter a number in the input. however if the number is 1 to press the button opens another page, but if the number is different does not open anything. The code i'm using is as follows:
<html>
<head>
<title>RHM</title>
<style type="text/css">
h1 { color: red; font-family: arial; font-size: 3em; font-weight: bolder; }
p { color: navy; font-family: Verdana; }
</style>
</head>
<body>
<h1 align="center">INGRESE CONTRASEÑA</h1>
<form action="#" method="post" >
<p align="center"> <input type="password" name="contras" style="width:200px;height:50px;background-color:yellow;color:blue;font-size:14pt;font-family: Comic Sans MS;text-align:center;padding-right:10px;"/></p>
<p align="center" ><input type="submit" value="Entrar" /></p>
<?
$Contraseña=$_POST['contras'];
if ($Contraseña==1) {
action=="Decidir.php";
}
?>
</form>
</body>
</html>
So far as this does nothing. please help thank you all.
I solved it like this:
....
<?
$Contraseña=$_POST['contras'];
if ($Contraseña==10836053) {
header("Location: Decidir.php");
}
?>
</form>
Thank sam_io.
I need some help regarding my little css code. I want all my elements to be still in the stage of zooming in and zooming out in the browser.
I would appreciated a little tweak in my code.
The CSS Code:
form{
position:absolute;
top:270px;
right:490px;
}
input{
}
ul{
margin-top: 330px;
padding-left: 410px;
}
li{
padding:10px;
list-style-type: none;
display:inline;
font-size: 13px;
font-family: "Lucida Console";
}
h4{
position: fixed;
margin-left: 1115px;
margin-top: -220px;
letter-spacing: 2px;
}
Index code:
<html>
<head>
<title>Pogo++</title>
<link rel="stylesheet" type="text/css" href="search.css">
<link rel="stylesheet" type="text/css" href="http://themes.googleusercontent.com/static/fonts/roboto/v11/2UX7WLTfW3W8TclTUvlFyQ.woff">
</head>
<body>
<center>
<img src="pogo++.jpg" width="510px" height="auto">
</center>
<form action = "search.php" method="get">
Pogo: <input type="text" name="value" placeholder="Search Anything" style="height:40px; width:240px;" >
<input type="submit" name="search" value="Pogo It" style="height:40px">
</form>
<?php
$con=oci_connect('system','system','localhost/XE');
if(isset($_GET['search'])){
$stid = oci_parse($con, 'SELECT * FROM search');
oci_execute($stid);
while($row=oci_fetch_array($stid)){
$title = $row['title'];
$link = $row['sitelink1'];
$desc = $row['sitedesk1'];
echo $title;
}
}
?>
<a href=#><h4>© 2014 Pogosoft</h4></a>
</body>
<footer>
<ul>
<li>Contact</li>
<li>Conditions and Terms</li>
<li>Confidentiality</li>
</ul>
</footer>
</html>
Hi everyone im new to php and would like to know how if it is possible to pass the data from a child window with a table containing data from the database and upon selection of which data to echo the value into the text area of the parent window using a checkbox within the child window.I would much appreciate it if anyone could provide some help on this. Below is the code. Thanks.
Child Window:
<head>
<!-- CSS goes in the document HEAD or added to your external stylesheet -->
<!-- CSS goes in the document HEAD or added to your external stylesheet -->
<style type="text/css">
table.hovertable {
font-family: verdana,arial,sans-serif;
font-size:11px;
color:#333333;
border-width: 1px;
border-color: #999999;
border-collapse: collapse;
}
table.hovertable th {
background-color:#c3dde0;
border-width: 1px;
padding: 8px;
border-style: solid;
border-color: #a9c6c9;
}
table.hovertable tr {
background-color:#d4e3e5;
}
table.hovertable td {
border-width: 1px;
padding: 8px;
border-style: solid;
border-color: #a9c6c9;
}
</style>
<!-- Table goes in the document BODY -->
</head>
<body>
<form action="retrievemath.php" method="post">
<table class="hovertable">
<tr>
<th>Insert ?</th><th>Expression Name</th><th>Math Expression</th>
</tr>
<tr onmouseover="this.style.backgroundColor='#ffff66';" onmouseout="this.style.backgroundColor='#d4e3e5';">
</tr>
<?php
while($row = mysql_fetch_assoc($queryResource))
{
?>
<tr>
<td><input type="radio" name="insert" id="<?php echo $row['mathID']?>" value="<?php echo $row['expressionname']?>" /> </td>
<td><?php echo $row['expressionname']; ?></td>
<td><?php echo $row['mathexpression']; ?></td>
</tr>
<?php
}
?>
</table>
<div class="submit">
<input type="hidden" name="formsubmitted" value="TRUE" />
<input type="submit" value="Insert" />
</div>
</form>
</body>
<?php
if (isset($_POST['formsubmitted'])) {
echo $_POST['insert'];
}
?>
Parent Window:
<head>
<script type="text/javascript">
<!--
function myPopup2() {
window.open( "retrievemath.php", "myWindow",
"status = 1, height = 300, width = 300, resizable = 0" )
}
//-->
</script>
<script src="ckeditor/ckeditor.js"></script>
</head>
<body>
<textarea class="ckeditor" cols="80" id="editor1" name="editor1" rows="10" ></textarea>
<form>
<input type="button" onClick="myPopup2()" value="POP2!">
</form>
<p onClick="myPopup2()">CLICK ME TOO!</p>
</body>
your parent window can be accessed by "window.opener" here is an example how you can send data from child to the parent window.