473,789 Members | 3,084 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

PHP will not post vars.

When every I submit my form information it just puts the <?php echo
$PHP_SELF?> as part of the URL. Please help....

---------------------------------------------------------------
<html>
<body>

<?php
if ($submit){
//connect to database
//$host = "host";
//$user = "user";
//$pass = "**";
//$database = "driveaf";

$db = mysql_connect(" host", "genuser", "pasword");
mysql_select_db ("driveaf", $db);
//Connected to data base
//write data to db
$sql = "INSERT INTO users (empID, firstname, lastname, email,
password, reg_date, website) VALUES ('$empID', '$firstname',
'$lastname', '$email', PASSWORD('$pass word'), '$reg_date',
'$website')";
$result = mysql_query($sq l);
echo "Thanks";
}else{
//

?>
<form method="post" action="<?php echo $PHP_SELF?>">
<p>Employee ID:
<input name="empID" type="text" id="empID">
</p>
<p>First Name:
<input name="firstname " type="text" id="firstname" >
</p>
<p>Last Name:
<input name="lastname" type="text" id="lastname">
</p>
<p>email address:
<input name="email" type="text" id="email">
</p>
<p>password:
<input name="password" type="text" id="password">
</p>
<p>
<input name="submit" type="Submit" value="Submit">
</p>
</form>

</body>
</html>
-----------------------------------------------------------------------
Jul 17 '05 #1
1 1577
Charlie T wrote:
When every I submit my form information it just puts the <?php echo
$PHP_SELF?> as part of the URL. Please help....
Are you sure that PHP is running on your machine? And are you really
sure that PHP does not use the default value for register_global s? If
resgister_globa ls is off (default!), then have a look at the following
changes:
<?php
if ($submit){
Should be:
if (isset($_POST['submit'])) {
$sql = "INSERT INTO users (empID, firstname, lastname, email,
password, reg_date, website) VALUES ('$empID', '$firstname',
'$lastname', '$email', PASSWORD('$pass word'), '$reg_date',
'$website')";
$sql = "
INSERT INTO users (
empID,
firstname,
lastname,
email,
password,
reg_date,
website
)
VALUES (
$_POST['empID'],
'$_POST[firstname]',
'$_POST[lastname]',
'$_POST[email]',
PASSWORD($_POST[password]),
'$_POST[reg_date]',
'$_POST[website]')
";

<form method="post" action="<?php echo $PHP_SELF?>">


<form method="post" action="<?php echo $_SERVER['PHP_SELF'] ?>">

Regards,
Matthias
Jul 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
4524
by: Gerard van Wilgen | last post by:
I have a client-application that uses a socket to post some data to a server-application. The following piece of code in the client takes care of the posting: $sock = fsockopen("www.majstro.com", 80, $errno, $errstr, 30); if ($sock) { $data = 'a=0&b=1'; fputs($sock, "POST /Web/Majstro/SD_Server.php HTTP/1.0\r\n"); fputs($sock, "Host: www.majstro.com\r\n");
0
1602
by: vishal | last post by:
hi today i read php5 and mysql book and i came to know that if cookie is enabled on client machine then php will use cookies to handle sessions else if cookie is disabled on client machine check is made to ensure that if php5 is configured with --enable-trans-sid and --enable-track-vars option. If yes then php will pass session id using post method automatically and we do not need to
0
1635
by: Lucas Branca | last post by:
python 2.1.3 Debian woody Apache 1.3.26 mod python 2.7.8 ## ---- formtest.html ---- ## <form action="/formtest.py/main" method="POST"> <input type="submit" value="go" name="action"> <input type="hidden" name="hide" value="A"> </form>
1
2653
by: Rod Castellanos | last post by:
Ive been looking everywhere, I need to get a var in my .psp file from another one, I managed to send it with a form and I can read it with "req.read" but it reads all of the variables together separated by a "&" like all POST/GET vars. How do I store each one in a python var, Im looking for something like $_POST and $_GET from php. Thanx.
10
3441
by: glenn | last post by:
I am use to programming in php and the way session and post vars are past from fields on one page through to the post page automatically where I can get to their values easily to write to a database or continue to process on to the next page. I am now trying to learn ASP to see if we can replace some of our applications that were written in php with an ASP alternative. However, after doing many searches on google and reading a couple...
4
1893
by: Sylvain Girard | last post by:
Here's the situation: I need to redirect to another page and post some vars. Response.Redirect doesn't work with post vars (at least not that I know of) and a WebRequest doesn't open the new page (at least not that I know of). How can this thing be resolved? *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it!
1
6706
by: Christopher J. Bottaro | last post by:
Hi, I can't for the life of me figure out how to get the post vars when using basehttpserver. Here's my code: <code> class MyHandler(BaseHTTPRequestHandler): def do_POST(self):
4
1500
by: Man-wai Chang | last post by:
I knew the GET way ('called.php?para1=aaa&para2=xxxx'), but how about the POST way? -- iTech Consulting Services Limited Expert of ePOS solutions Website: http://www.itech.com.hk (IE only) Tel: (852)2325 3883 Fax: (852)2325 8288
19
1988
RMWChaos
by: RMWChaos | last post by:
Previously, I had used independent JSON lists in my code, where the lists were part of separate scripts. Because this method did not support reuse of a script without modification, I decided to consolidate all my JSON lists into one and modify my scripts so that they were more generic and reusable. So far so good. The problem is that my JSON lists used variables for many pieces of code that performed multiple iterations to create several...
6
2621
by: goodguyjam | last post by:
Hi all, I'm having trouble with mysql. I've just finished my php coding for HTTP authentication and with some help am now getting a login window pop up whenever I click on a link on my website that directs to Auth.php. The code for this is below: <?php /* Program: Auth.php * Desc: Program that prompts for a user name and * password from the user using HTTP authentication.
0
9665
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
1
10139
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9983
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9020
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7529
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6768
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5551
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4092
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3697
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.