Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.
Terry Jones
php variable in html?
I'm trying to output a PHP variable in HTML but it's not happening.
Can someone have a look and see where I'm going wrong?
<?php
$ids = 2
?>
<html>
<head>
</head>
<body>
<tr><td><input name="name" type="text" value="<?php echo $ids; ?>"></td></tr>
</body>
</html>
all thats happening is there is a text box and in the text box it says <?php echo $ids; ?>.
I want it to output the value of the variable.
I've tried with and without the quotations and I still cant get the value of the variable to be output.
Any ideas?
Thanks
1 AnswerProgramming & Design8 years agoPHP Mysql issue outputting data?
Hi,
Im trying to get all the data from a column store it in a variable and echo it out.
here is my code:
<?php
include 'getStaffID.php';
include 'getContractID.php';
$connection = mysql_connect("localhost" , "root" , "password")
or die (mysql_error());
mysql_select_db("shift" , $connection);
$sql_3 = "SELECT contractName FROM contracts WHERE contractID = '$contractID'" ;
$results_3 = mysql_query($sql_3, $connection);
while($row_3 = mysql_fetch_array($results_3)) {
$contractName = $row_3['contractName'];
echo $contractName . '<br>';
}
?>
the problem is the variable $contractID at the end of the SQL query holds all of the data from another column in another table. I need it to do this because each contractID represents a contractName.
now instead of outputting every contractName associated with each contractID it's just outputting the last contractName.
what can I do to output every contactName that is associated with every contactID?
if my explanation is unclear pleas ask to clarify and I'll do my best.
Thanks!
2 AnswersProgramming & Design8 years agoWhy is my PHP code not working?
so firstly, here is the snippet that is not working:
$firstName = $_GET['FirstName'];
$lastName = $_GET['LastName'];
$username = $_GET['Username'];
$password = $_GET['Password'];
$age = $_GET['Age'];
$email = $_GET['Email'];
$query = "SELECT * FROM users WHERE Username='$username'";
mysql_query($query , $testdb);
if(mysql_num_rows($query) > 0) {
echo 'Username already exists!!' ;
} else {
// sql query
$sql = "
INSERT INTO users (Username , Password , FirstName , LastName , Age , Email) VALUES('$username', '$password' , '$firstName' , '$lastName' , '$age' , '$email' )
";
//send data in variable $sql to database stored in $testdb
mysql_query($sql , $testdb);
header("location:registration_successful.php");
}
For some reason I cant get it to say the username already exists.
It registers the user and goes to the registration_successful page even if the username is already in the database.
Not sure what I'm doing wrong.
I'm new to php and mysql but it looks right to me.
Thanks.
3 AnswersProgramming & Design8 years agoYamaha sr 125 starting issues?
Hi, the wind blew my bike over just now (on it's left side). Petrol was leaking from a tube. The tube is in the middle of the bike. Quite thick. And I had never noticed this tube before. I have no idea if this has become disconnected some how or if it was always there. Since the fall, the bike takes ages to start. Any help would be appreciated. Thanks.
3 AnswersMotorcycles8 years agoCan I run a GTX550ti and a GTX560ti together in SLI?
Simple really. I have a GTX550TI and I'm getting a GTX560ti so I was wondering if I could run them in SLI or would they have to both be the same card?
Thanks
2 AnswersDesktops9 years agowhat is wrong with this php code?
Hi, this is my first day trying to learn PHP. I'm using a "for dummies" book.
this is the code from the two pages
1) <body>
<form action = "greetUser.php"
method = "get">
<fieldset>
<label>Please enter your name</label>
<input type = "text"
name = "userName" />
<button type = "submit">
submit
</button>
</fieldset>
</form>
2)
<?php
$userName = $_REQUEST["userName"];
print "<h2> Hi, $userName!</h2>";
?>
problem is when I click submit I get this error:
Notice: Undefined index: userName in H:\XAMPP\htdocs\greetUser.php on line 2 Hi, !
I have copied it out of the book so it should work.
I have checked the syntax is the same as in the book and as far as I can see it is.
I'm just stumped. Like I say this is my first time with PHP so to get this error straight away, and not being able to see where I've gone wrong is very frustrating!!
I have also tried putting an @ sign in front of $userName but all that happens then is I get
Hi, !
so it's as if the variable is not recieving data that it should.
plz help me figure this out.
Thanx
Terry
3 AnswersProgramming & Design9 years agohow to search with windows 7?
hi,
so just a quick one.
if I want to search just the C: drive of my computer for a file extension (e.g .avi) and I had to use the "search all programs and files" bar in the start menu how do I do it.
It has to search just the C: drive
it has to be that search bar in windows 7.
many thanks
4 AnswersSoftware9 years agoCan you solve this maths problem? #2?
the sampling distribution of the mean weight, for samples of 50 bags of sugar, has mean 0.991KG and standard Deviation 0.0085kg.
1) choose the option that is closest to the probability that the mean weight for a sample of 50 bags of sugar will be more than 1KG.
options: a) 0.0089 b) 0.0145 c) 0.1448 d) 0.5 e)0.8111 f) 0.8552
2) choose option that gives on approximate range of values, in kg, symmetric about the mean within which the mean weight for approximately 90% of samples of 50 bags will lie.
options:
a) 0.986, 0.996 b)0.983, 0.999 c) 0.979, 1.003 d)0.977, 1.005 e)0.974, 1.008 f)0.969, 1.013
If you manage to figure it out, could you let me know how you came to you answer.
this might help: http://www.math.unb.ca/~knight/utility/NormTble.ht...
1 AnswerMathematics9 years agoCan you solve this maths problem?
the lifetime of electric bulbs of a certain make may be modeled by a normal distribution with mean 560 hours and standard deviation 62 hours
1) choose the option that is the closest to the lifetime in hours above which 25% of the bulbs will last
options:
a)518.18 b)601.82 c)625.00 d) 700.00 e)728.33 f)782.33
2) choose the option that is the closest to a range of values, to one decimal place, symmetric about the mean, within which approximately 90% of the lifetimes of the bulbs will lie.
options:
a) (438.5, 681.5) b) (460.8, 677.8) c) (460.8, 659.2) d) (473.2, 646.6) e) (467.0, 653.0) f) (458.0, 662.0)
13) choose the option that is closest to the percentage of the bulbs which will last less than 500 hours.
options:
a) 14% b)15% c)16% d)17% e)71% f)83%
if you figure it out can you let me know how you got the answers?
thank you.
also you can email me jonest27@hotmail.co.uk
2 AnswersMathematics9 years agohow to make the time auto-update in javascript.?
ok I'm a newb to javascript. and I know this code will display the time and date : ourDate= new Date();
document.write(ourDate.toLocaleString());
what I'm wondering is how do I turn that into a clock so that the time updates every second (like a clock) without having to refresh the page.
I'm not really looking for a code snippet, or if there is one could you explain it?
remember, Noob!!
Also I'm trying to learn javascript, so please don't say stuff like "you should write it in PHP or AJAX ect." one thing at a time lol.
1 AnswerProgramming & Design9 years agowhy is there no display to my TV from my computer?
HI. I have always had my pc hooked up to my tv. usually either through DVI to vga (using an adapter) or through HDMI. Today I went to change my graphics card. I uninstalled the old one and as normal the screen went into standard vga mode (the old card was being used Dvi to vga with an adapter (also the resolution was set to 1080p)). I then shut down the computer, took out the old graphics card and put in the new one(again started off trying dvi to vga through adapter). ever since I have had no display. I have tried the new card through hdmi as well but no luck. I even tried putting the old card back in but again nothing. one card is Radeon HD 4870, the second card is Radeon HD 5450. I have only tried through my TV. I don't at present have a computer monitor (would it make a difference if I used a monitor instead?). can anyone help? please get bk to me asap. thanks
2 AnswersMonitors10 years agowhy is my HTML code not working?
hiya, been trying to embed a small music player into a webpage but it's not working.
I'll show you the code I've used. I've even tried just copying and pasting code from the web. here are the codes I've tried.
<object width="100" height="40">
<param name="src" value="C:\Users\Terry\Music\Bruno Mars-Doo Wops And Hooligans-2010-H3X"
<param name="autoplay" value="true"
<param name="controller" value="true">
<param name="bgcolor value="red">
</object>
also
<embed src="C:\Users\Terry\Music\Bruno Mars-Doo Wops And Hooligans-2010-H3X" autostart="true" loop="false" width="100" height="40"
controller="true" bgcolor="red"></embed>
I've also tried them both together. but still nothing. I either get a blank box or a message pop up saying " an addon failed to run" I've tried the codes in a few different browsers but still nothing.
please help coz I'm stumped!!!!
4 AnswersProgramming & Design10 years agohow do I go about introducing pups to their father?
Right before I start the litter was an accident and yes the mother has now been spayed and I have looked into this but there doesn't seem to be much specific to my situation.
So, basically my dog had pups and they are 4 weeks old. they are all walking and talking and I have started weaning them.
the father has met them a few times and he's great with them the problem is that every time the mother is around I can't let the father near them because the mother gets very aggressive towards him.
neither have ever shown any aggression towards the pups so that's a good thing but eventually they are going to have to get along.
so I'm wondering what's the safest way to get the mother to accept the father and realize that he will not harm the pups?
Thanx for your help.
6 AnswersDogs10 years agowill I be able to put my processor in my new computer?
hi! tomorrow (13/07/11) i am buying a new (second hand ) gaming pc. this is the spec
Nvidia sli gaming pc
- Nvidia Graphics Card (881 mb graphics memory in total)
- 2 gb ddr2 ram
- 4 Ddr2 ram slots available supporting 8gb of ram
- Dual pcie x16 slots for two graphics cards
-160gb 2.5 inch HDD
-Built in card reader
- Asus P5ND2-SLI Deluxe motherboard
I have another computer (which is more modern but does not have the gaming capabilities) and the processor is
AMD Athlon II x3 435.
so basically im wondering if I can just put the processor from the more modern one into the older one.
can u answer asap plz as im getting it 2moro.
thnx.
7 AnswersDesktops10 years agois there a way to use the internet as ram?
i read recently the a ceo of google estimated that the internet contains about 5million TB of data. and as this will inevitably grow the amount of space is probably infinite. so im wondering is there a way to use the "empty space" (which is used to store data) as RAM.
any ideas?
1 AnswerOther - Internet1 decade ago