Archive for September, 2009
Need help with PHP programming?
Here is the code provided by the teacher. (mrvaughan.com)
<html>
<head></head>
<body>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST">
<input name="crush" size="30">
<input type="hidden" name="all" value="<?php echo $_POST['crush']."<br>".$_POST['all'] ;?>" size="30">
<input type="submit" name="submit" value="add">
</form>
<?php echo $_POST['crush']."<br>".$_POST['all'];//}
?>
</body>
</html>
What it does is it creates a field to enter your word into and when you click "add" it puts it into a list below. I need to explode the list created into an array, sort it then display it on the screen. teacher said it should be 4 lines added to above code to do this. Please someone try it. I DID NOT CREATE THIS CODE I AM NOT CRAZY
(WAMP SERVER)
Ok I assume that you are familiar with Mysql because no matte what you have to create a database, that will be your first file. Then you need the file to connect to the data base and that you would call that conect.php or what ever you like. You need your input file input.php where the summited information will be send to the database. Then you need your display.php file where the information will be sorted and sent back to you where ever you like it. Is not a simple copy and past job over all. Visit various sites on the net if you don’t have the PHP bible or any PHP books on how to go about it. GOOD LUCK and have fun. You can have it all in one file but is much neater and more flexible if you have a file for each process you want ot achieve.
Need help with php programming?
Here is the code provided by the teacher. (mrvaughan.com)
<html>
<head></head>
<body>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST">
<input name="crush" size="30">
<input type="hidden" name="all" value="<?php echo $_POST['crush']."<br>".$_POST['all'] ;?>" size="30">
<input type="submit" name="submit" value="add">
</form>
<?php echo $_POST['crush']."<br>".$_POST['all'];//}
?>
</body>
</html>
What it does is it creates a field to enter your word into and when you click "add" it puts it into a list below. I need to explode the list created into an array, sort it then display it on the screen. Please someone try it. I DID NOT CREATE THIS CODE I AM NOT CRAZY
(WAMP SERVER)
Thank you
haha. This answerer above looks like he knows the correct way, heres another in case you don’t understand. I took out the hidden text field. This will come in handy too once you learn sessions.
you can use session variable for this. A session variable keeps the value of any parameter you send it throughout the duration of the session between the client and the server side script. So, you can keep a counter variable to index the list.
The first conditional will execute once since the first time you visit the page, the POST variable will be null(check the null terminator, it may be wrong. Im a j2ee koder). Afterwards you can keep incrementing the counter parameter in the SESSION variable to get the proper index for the list you are saving the values of the input field in the HTML and continue to use the list and array.
I can’t remember what explode does. I think it places list values into an array. after you do explode(), echo the array!
Most the work is done. You may have to check into lists in php. GL.
<?php
if($_POST['crush'] == ‘/0′)
{
session_start();
$_SESSION['counter'] = 0;
$a = array();
$list = list();
}
else
{
$_SESSION['counter']++;
$count = $_SESSION['counter'];
$list[$count] = $_POST['crush'];
$a = explode($list);
sort($a);
echo $a;
}
?>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST">
<input name="crush" size="30">
<input type="submit" name="submit" value="add">
</form>
</body>
</html>
I have instaled PHP in my PC Pentium 4 and even after disabled IIS, the PHP program doesn’t run.?
PHP 4 with My SQL server (already downloaded from PHP.net).
Instead of going for php, mysql and apache separately. Install WAMP5 which install php, mysql with PHPMyAdmin and Apache, all you have to do is double click the exe file and follow the instructions and php will run on your system once you start the wamp server.
Hope this helps!!!
need help. PHP Masters?
can anyone tell me what are the different tools that can make programming in php much easier? techniques and tools can help a lot.. thanks in advance.. cheers!
You are asking a wrong question. Programs that were easy to write are usually a living hell to maintain and operate. To develop a good program, you need to understand both the user who will operate it and the computer that will run it. This, alas, requires years of practice…
PHP programming?
1.Write a program which can convert a temperature in Fahrenheit to the corresponding temperature in Celsius and vice versa?
Im a new user to PHP so need help to study the PHP . I cant really understand the programm.
Here’s a simple PHP form that will do the trick. And If you’re looking for a great site to learn PHP, go to: http://www.tizag.com/phpT/index.php
<form action="<?php $PHP_SELF ?>" method="post">
Fahrenheit Temp: <input type="text" size="3" name="tf"> <br><br>
Celsius Temp: <input type="text" size="3" name="tc"><br><br>
<input type="submit" value="CONVERT">
</form>
<br><br>
<?php
// Request the variables from the form.
$tf = $_REQUEST['tf'] ;
$tc = $_REQUEST['tc'] ;
//To convert a Fahrenheit temperature to Celsius, we use the following formula: (5/9) * (F -32)
//Since we need the 5/9 and the F - 32 value in parenthesis, we assign them to variables to make the procedure possible in PHP.
$x = 5 / 9;
$y = $tf - 32;
$temp_c = $x * $y;
// To convert a Celsius temperature to Fahrenheit we use the following: F = (9/5) * C + 32
$temp_f = 9 / 5 * $tc + 32;
// Now we print the results:
if ($tf) {
echo "Temperature in Celsius is: <b> $temp_c </b>";
}
if ($tc) {
echo "Temperature in Fahrenheit is: <b> $temp_f </b>";
}
?>
what program used in php programming language?
Ummmm… PHP.
(that was easy)
Actually, it’s a bit more complex in practice. PHP is almost always run in conjunction with a web server, and it frequently interfaces with a database. Most PHP programmers also use a web server (Apache is by far the most common choice as it’s free and very powerful) and a database (MySQL is a very popular choice, because it’s also free, powerful, and works great with PHP.)
It can be intimidating to install all this software, so your best bet is to get a free installer that helps you install and configure the whole thing in one step. I really like XAMPP, because it’s easy and it has everything you need. You can download it for free from
http://www.apachefriends.org/en/xampp.html
XAMPP contains apache, PHP, MySQL, phpMyAdmin (a database administration tool) and some other goodies.
You can edit your PHP programs in a plain text editor, but I prefer an editor that helps with PHP syntax. My personal favorite is Aptana ( http://www.aptana.org ) because it has syntax highlighting and completion for PHP (just like the expensive commercial IDEs) Aptana has a free community edition that has all the power you need.
And of course if you need a book to describe how to use all this, I’ve got a couple of suggestions….
EDIT:
Apache is NOT a php interpreter, it’s a web server.
Dreamweaver is really not designed to help with PHP (in fact, it’s not that great at HTML and CSS, which it -is- designed for.)
online learn web programming; Where?
i am beginner of web programming but i have not much more idea of php and mysql. so some one tell me where i have to go for learn. for best web site to learn beginner to advance for free. tell me the best web site like: http://w3schools.com
wiki books has alot of web programming languages u can learn
http://en.wikibooks.org/wiki/PHP_Programming
Could you give me the steps needed for running a PHP program in Linux/ Web browser?
I had only a single system. I need to run my php program in my web browser like Mozilla. How can I earn it?
if your Linux system is configured with apache/php/mysql, then just copy the php file into the http-root folder (typically /var/www)
assuming that your PHP file is named myfile.php, to access the page, in your webbrowser type
http://localhost/myfile.php
PHP and my Career?
PHP and my Career
Hi, I am an IT (BTech) Engg. graduate of 2005. I got my first job in PHP of worth Rs 4000/month. Recently some of my friends(who is also working in php for yrs) told me that PHP doesnt have any future. No big multinationals and fortune companies work on this language. Only freelance work is done in PHP.
I have a good background in vb6 and vb.NET and I did many projects on both. But as I got the job in PHP, is it a problem if i want to shift to another company for a job which is not in PHP ? If yes , then am I heading towards a bad future in computer programming ?
What should i do now ? continue in PHP as I am a fresher or i’ll search for a .NET job(which is very difficult as i’m fresher and i’m in kolkata now) ?
Thanks in advance.
Bye.
I believe all of us do have this question in the back of our minds, especially with the huge request of free source php programming, but i still think you do not need to make a huge jumpin your life in one day. so it would be better if you do what you are good at and gradually and smoothly work on projects in VB or .NET, untill you find professionalism in your work. but i totally agree that the world is shifting towards .NET and Oracle programming but still huge and vast area of the world still using open source.
why won’t my PHP program update my ACCESS database on the Server?
I am developing some PHP programs for a website. I’ve been developing locally on my laptop using Apache. Locally, I can access, insert, and modify the tables in my ACESS database.
When I uploaded everything to the server, I can still acess the database to get info, but when I try to insert or update different tables I get a NULL return from odbc_exec.
Does anyone have suggestions?
Just a suggestion but I would not try to use Access on a live server. MySql will way out perform it and its open source. Access only allows 5 connections at a time!