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('$password'), '$reg_date',
'$website')";
$result = mysql_query($sql);
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>
----------------------------------------------------------------------- 1 1561
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_globals? If
resgister_globals 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('$password'), '$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 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
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 =...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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):
|
by: Man-wai Chang |
last post by:
I knew the GET way ('called.php?para1=aaa¶2=xxxx'),
but how about the POST way?
--
iTech Consulting Services Limited
Expert of ePOS solutions
Website: http://www.itech.com.hk (IE only)...
|
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...
|
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...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
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...
|
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...
|
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,...
|
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...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |