Wrox Programmer Forums
|
Beginning PHP Beginning-level PHP discussions. More advanced coders should post to the Pro PHP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning PHP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 16th, 2005, 07:10 AM
Authorized User
 
Join Date: Jan 2005
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Default Beggininng PHP

I have just started reading my first book of PHP. I have installed Apache 1.3 and PHP 4.3.10 (manual install). Apache works and PHPINFO command shows info of PHP in browser. But when I prepare the first form shown in the book the variable is not sent to the .php file. It is not shown in the browser in result. I don't know why it doesn't work.
The index.htm is:

<html>
<head></head>
<body>
<form action="text.php" method=get>
blablablabla
<input type="text" name="something">
<br>
<input type=submit>
</form>
</body>
</html>



and the text.php file is:

<html>
<body>
<?php
echo $something;
?>
</body>
</html>


In result I see only blablablabla in browser



Please, anyone tell me how to install PHP on apache.


Yo
__________________
Yo
 
Old January 16th, 2005, 11:26 AM
Authorized User
 
Join Date: Jan 2005
Posts: 82
Thanks: 0
Thanked 0 Times in 0 Posts
Default

for the form, do

method = POST

and in text.php

$something = $_POST['something'];

echo $something;


make sure they are in the same folder with the way you are pointing.

 
Old January 17th, 2005, 03:54 AM
Authorized User
 
Join Date: Jan 2005
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Incredible, works. ther was no mention about this in the book. Thanks a lot.

Yo
 
Old January 17th, 2005, 04:52 AM
Authorized User
 
Join Date: Feb 2004
Posts: 81
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to knight
Default

dear
may be ur book was published earlier infact after php 4
register globals directive is off that y u collect ur form
variable via $_get[] or $_post[] and when u r not sure u may
use $_request[] super global array or collection

 
Old January 17th, 2005, 09:39 AM
Authorized User
 
Join Date: Jan 2005
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I see.

Yo
 
Old January 17th, 2005, 09:51 AM
Authorized User
 
Join Date: Jan 2005
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Default

But how to change that, so that i wouldn't have to use $_POST all the time

Yo
 
Old January 18th, 2005, 07:19 AM
Authorized User
 
Join Date: Jan 2005
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Is there any other way to set it globaly, maybe in PHP.INI ?
If there is not, how to define an array, defined in another .php.

Yo
 
Old January 18th, 2005, 05:45 PM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts
Default

It is generally a good practice not to use register_globals, but if you like you can go into php.ini and look for register_globals and turn it on.

-Snib - http://www.snibworks.com
Where will you be in 100 years?





Similar Threads
Thread Thread Starter Forum Replies Last Post
Beg. PHP 5 > Ch. 11 - fetch_field.php crater BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 0 January 2nd, 2007 12:20 PM
PHP Warning: PHP Startup: Unable to load dynamic l surendran Beginning PHP 1 May 29th, 2006 08:49 AM
begin php & mysql - chapter 12, user_form.php jon_stubber Beginning PHP 1 March 9th, 2006 10:57 AM
Beggininng PHP zarol Beginning PHP 1 January 18th, 2005 11:35 AM
Error: movie.php & commit.php on p182-186, ch6 willburke BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 0 October 12th, 2004 02:48 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.