hosted by liquidweb

Go Back   Web Hosting Talk : Web Hosting Main Forums : Programming Discussion : Apache/php/mysql problem

Forum Jump

Apache/php/mysql problem

Reply Post New Thread In Programming Discussion Subscription
Send news tip View All Posts Thread Tools Search this Thread Display Modes
Junior Guru Wannabe
Join Date: Apr 2003
Posts: 42

Apache/php/mysql problem


I have installed an apache v. 1.3.29 with php 4.3.4 and mysql 3.22 on my pc with win98 in order to test some scripts and I got a problem. I can`t pass variables from my browser to a php script. something goes wrong. i tested it on my host but it works fine.
I even wrote a very simple script in order to test it but still nothing
Here is the code:
<form action="process.php" method="post">
<input type="text" name="txt1"><br>
<input type="submit" name="btn1">

(first i created a mysql database named "test" with a table named table1 and a column named "sqtest" which is a VARCHAR(20)
mysql_connect("localhost", "", "") or
die("cannot connect");
mysql_selectdb("test") or
die("cannot select db");

$query="INSERT INTO table1(sqtest) VALUES ('$txt1')"

mysql_query($query) or
when i execute this starting from index.htm and check the database, the entry is creted blank. so I put to the beggining of process.php this line:
but the result is just nothing which means the $txt1 variable is blank. What`s wrong? Its for sure not in my code cause as i said i tested it on my host and it works.
The problem is that it doesn`t pass the value of the "txt1" text box to the process.php script. any ideas?

sorry for my bad English.

Sponsored Links
Join Date: Dec 2003
Location: Tampa Area FL
Posts: 27
the problem is your host is probably running an older version of PHP or has register_globals enabled, in later version of PHP it was turned off do to alot of security concerns use the global arrays instead

$_POST['txt1'] if form method is post
$_GET['txt1'] of sent via get.

Erik S.
Developer / Owner

Junior Guru
Join Date: Sep 2003
Location: London, UK
Posts: 188
You can edit your php.ini file to reflect your hosts setup if you want just change REGISTER_GLOBALS
It should be in c:\windows


Sponsored Links
Community Guide
Join Date: Dec 2002
Location: The Shadows
Posts: 2,901
You should actually use something like:

$txt = ( $HTTP_POST_VARS['txt1'] ) ? $HTTP_POST_VARS['txt1'] : $_POST['txt1'];

Dan Sheppard ~ Freelance whatever

Web Hosting Master
Join Date: Jul 2003
Location: East TN
Posts: 568
Try to remember the
tags when posting code.

PS Just posted so a MOD wouldn't have to....

Take care,
-- Please use tags for code. PM me for information if not sure how to do so. | Refer to PHP Manual and MySQL Manual before posting.


Related posts from
Title Type Date Posted
CloudLinux Releases Software for Web Hosts to Set Limits on Accounts Running MySQL Web Hosting News 2015-01-26 14:42:26
Google Releases Hosted Database Service Cloud SQL to General Availability Web Hosting News 2014-02-12 13:46:02
Rackspace Makes Big Data Move with New Apache Hadoop Solution Web Hosting News 2013-10-28 11:12:05
Apache Market Share Falls in Netcraft October Web Server Survey Web Hosting News 2013-10-04 14:34:11
Researchers Urge System Admins to Check for New Apache Web Server Backdoor Malware Web Hosting News 2013-05-01 11:35:53

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes
Postbit Selector

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump
Log in with your username and password

Forgot Password?
WHT Host Brief Email:

We respect your privacy. We will never sell, rent, or give away your address to any outside party, ever.

Web Hosting News:
WHT Membership
WHT Membership



Welcome to

Create your username to jump into the discussion! is the largest, most influentual web hosting community on the Internet. Join us by filling in the form below.

(4 digit year)

Already a member?