hosted by liquidweb


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

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
  #1  
Old 12-02-2003, 01:27 PM
some12k some12k is offline
Junior Guru Wannabe
 
Join Date: Apr 2003
Posts: 42

Apache/php/mysql problem


Hello

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:
---
index.htm
---
<form action="process.php" method="post">
<input type="text" name="txt1"><br>
<input type="submit" name="btn1">
</form>

(first i created a mysql database named "test" with a table named table1 and a column named "sqtest" which is a VARCHAR(20)
---
process.php
---
<?
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
die("error");
?>
---
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:
echo($txt1);
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
  #2  
Old 12-02-2003, 01:38 PM
PHPConcepts PHPConcepts is offline
Newbie
 
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

  #3  
Old 12-02-2003, 01:43 PM
lucid lucid is offline
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

Rob.

Sponsored Links
  #4  
Old 12-02-2003, 06:57 PM
Sheps Sheps is offline
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

  #5  
Old 12-11-2003, 02:04 PM
blackbelt080 blackbelt080 is offline
Web Hosting Master
 
Join Date: Jul 2003
Location: East TN
Posts: 568
Try to remember the
Code:
 AND
tags when posting code.

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

__________________
Take care,
Lori
-- 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.

Reply

Related posts from TheWhir.com
Title Type Date Posted
Google Releases Hosted Database Service Cloud SQL to General Availability Web Hosting News 2014-02-12 13:46:02
Google Cloud Provides Support For Native MySQL Connections Web Hosting News 2013-11-01 14:36:06
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
Login:
Log in with your username and password
Username:
Password:



Forgot Password?
Advertisement:
Web Hosting News:



 

X

Welcome to WebHostingTalk.com

Create your username to jump into the discussion!

WebHostingTalk.com 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?