Archive for August, 2010

I m writing Php code in html program. nw i need how to read value of input tag in php program?


Uhm….. more information would be very helpful. Possibly an example of your code and what you’re trying to do?

You might want to check out http://www.w3schools.com/php/php_post.asp

I wrote a program in PHP with so many variables. I don’t want to use submit button. is there anyway 2 use href?

when I use <a href> <a/> , it doesn’t POST the variable to the destination. it only go to that page without any process. I could also use dropdown list with 1 submit button.
Thanks in advance.

Use cookies, http-header, GET, POST, AJAX and I think that just about it.

Questions about learning to program in PHP?

How long does it take to learn how to program in php? Also, do you have to get special software etc. to do it? Or can someone write PHP in a program like Adobe Dreamweaver. Sorry if this is a really dumb question lol. Also, what are the differences in the different versions of PHP such as PHP 2X, 4X, and 5X? Thanks in advance for any answers!

Dreamweaver is very bad at dealing with any server-side script, like Php. Use DW to build your site, then Notepad++ and Php to "make it work".
Php is loosely based on "C", so if you have a little experience of C programming, Php will "look" very similar. It is relatively easy to learn. Go to http://www.php.net to get plenty of examples.
How long does it take to learn it? You can get the basics in a few days. Go to w3schools.com to get started.
There are two ways of running Php:
1. Upload your scripts to a server that has Php enabled (you can then see the results in your browser)
2. Download and install XAMPP on your own machine (google "Apache Friends XAMPP" to get the download. Once installed, you can run php scripts off-line.

please please help me in this PHP program problem.. please its urgent..please?

i created a div and set a background image in that div by using style tag and in that div i created a form… so i want to create a button with onclick event… so that whenever that button is clicked the background image of the div should be changed…so please please help me how to do this?

<div id="div3" style="background-image:url(../images/re… border:double; border-color:#666666; z-index:1; width:230px; height:350px;position:absolute; left:45px; top:15px;">
<form name="chatting1" action="chat1.php" method="post">

<textarea name="chat1" cols="25" rows="3"></textarea>
<br>
<input type="submit" name="submit" value="REPLY">

now create a button which changes the background image of the div whenever it is clicked…

<head>
<script>
bkgnew = new Image(); // preload the image!
bkgnew.src = "newimage";
function change_bkg()
{
var x = document.getElementById(‘div3′);
x.style.background-image = "url(newimage)";
}
</script>
</head>
<body>
<div ….
<form …
<input … onmousedown="change_bkg(); return false;" />

Preload the image with the first two lines of the script.
Use "onmousedown" instead of "onclick": When you click, the form will be sent, and you will not have the time to see the change!
Get the free script "mini Chat" at http://www.web2coders.com

Where can I learn PHP and Mysql scripting/programming?

I am 15 years old, I have an interest in programming and web design, I can make websites with dreamweaver etc, and have used html scirpts and things but never actually learned how to do php and mysql, besides knowing how to use it, and use mysql database that i’ve used for ready made scripts. I always find the websites I want to make, need intermediate to advanced php/mysql programming to make such interfaces like even a simple CMS. Can anyone tell me where to start, it’s best to start younger, where can I learn? somewhere on computer at home? Also, someone siggested for me to download wamp which i’ve had for ages and xampp, I know how to use phpmyadmin etc and things, i’ve hosted websites and used web servers. I always use premade scripts, where can I learn from the begining how to write porgramme php and mysql? Thanks. :)

If you have WAMP, you don’t need XAMPP.

I studied PHP and MySQL from this book:

http://www.amazon.com/dp/1590598628/

I like it. It doesn’t bring you to ‘pro’ level, but gives you enough knowledge to help you get you there by yourself.

PHP Programming Help!?

Ok, I’m doing an assignment for school that is really confusing me. I made an htm form that is supposed to leave a box for you to enter a grade letter, and after doing so, you will get a different result depending on the letter you typed. I made the PHP file, but no matter what grade I type, it gives me the same result every time, "Your grade is excellent!". I need help with making it give me different results depending on what I type, and I think the main problem is my call statement.

This is my html form (which is fine):

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Letter Grades</title>
</head>

<body>
<form action="LetterGrades.php" method="get">
<p>Grade: <input type="text" name="Grade" />
<input name="Submit" type="submit" id="Submit" />
</p>
</form>
</body>
</html>

And this is my PHP file:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Letter Grades</title>
</head>

<body>
<?php

function checkGrade($Grade) {
switch ($Grade) {
case "A":
echo "Your grade is excellent.";
break;
case "B":
echo "Your grade is good.";
break;
case "C":
echo "Your grade is fair.";
case "D":
echo "You are barely passing.";
case "F":
echo "You failed.";
default:
echo "You did not enter a valid letter grade.";
}
}
echo checkGrade("A");

?>
</body>
</html>

Could someone please help me?
Thanks, Frank! I think it’s a step in the right direction, but the only problem now is that it’s giving me the default answer everytime now, which is, "You did not enter a valid letter grade."

Do I need to define the A, B, C, D, F variables anywhere?
Ok, it works now, thank you, Frank!!! :D

I think you wrote a good script. The problem with this script i think will be at the last statement (echo checkGrade("A");).

Instead of you writing echo checkGrade("A"); I suggest you write
echo checkGrade("$Grade");
Ooh plus you haven’t linked the form with the php script
write something like:

<?php

function checkGrade($Grade) {
$Grade = $_GET['Grade'];
switch ($Grade) {
case "A":
echo "Your grade is excellent.";
break;
case "B":
echo "Your grade is good.";
break;
case "C":
echo "Your grade is fair.";
case "D":
echo "You are barely passing.";
case "F":
echo "You failed.";
default:
echo "You did not enter a valid letter grade.";
}
}
echo checkGrade("$Grade");

?>

When u enter url of a php file, program to do specific function?

and when u close web-page in middle of processing will php file will continue till end?

Yes. simple and straight answer.