PHP 4.2+ and Windows 95?? Any known probs?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
Skittlewidth
Forum Contributor
Posts: 389
Joined: Wed Nov 06, 2002 9:18 am
Location: Kent, UK

PHP 4.2+ and Windows 95?? Any known probs?

Post by Skittlewidth »

This is only indirectly my problem for once hee hee!!

On of my new collegues is learning PHP on a worn out windows 95 machine. We've downloaded the latest version of PHP and Apache and installed MySql 3.23.

He's learning from an old book so I think this is where the problem originates. Anyway its the old "I can't pass this variable" problem again.

YES we've checked the php.ini file and although whether we set register_globals to on or off I found I could only access posted variables by using $_POST['variablename']

Now the problem is we can't get the data into the database.
I'll post the two scripts but they're probably in a right mess now because we've played around with them so much just trying to get the thing to work!! I'm probably just overlooking something obvious!!!

Code: Select all

employeeform.php
<HTML>
<HEAD>
<TITLE>Employee entry form</TITLE>

</HEAD>
<BODY>

<P>Please fill out the form below to submit your first name, last name, address, and position.</P>

<FORM NAME="employees" METHOD="POST" ACTION="employeesEntry.php">
First name: <INPUT TYPE="text" NAME="first" SIZE=25><BR>
Last name: <INPUT TYPE="text" NAME="last" SIZE=25><BR>
Address: <INPUT TYPE="text" NAME="address" SIZE=25><BR>
Position: <INPUT TYPE="text" NAME="position" SIZE=25><BR>
<INPUT TYPE="SUBMIT" NAME="SUBMIT" VALUE="Enter Information">

</FORM>

</BODY>
</HTML>
employeesentry.php

Code: Select all

<?php
  $DBhost = "localhost";
  $DBuser = "shearn";
  $DBName = "employees";
  $table = "employees";

if ($_POST&#1111;'SUBMIT'] == "Enter Information") &#123;

	echo "<BODY>First Name:", $_POST&#1111;'first'],"<br>";
	echo "Last Name:",  $_POST&#1111;'last'],"<br>";
	echo "Address:",$_POST&#1111;'address'],"<br>";
	echo "Position:", $_POST&#1111;'position'], "<br><br></BODY>";



  //process form

  //$dblink =
  mysql_connect("localhost") or die(mysql_error());
  mysql_select_db("employees") or die(mysql_error());
  print ("Connected successfully.");

  $first=$_POST&#1111;'first'];
  $last=$_POST&#1111;'last'];
  $address=$_POST&#1111;'address'];
  $position=$_POST&#1111;'position'];

  $sql ="INSERT INTO employees (first, last, address, position) VALUES ('$first',$last','$address','$position')";
  //$result =
  mysql_query($sql);

  print(" Your information has been recorded.");

  //mysql_close($dblink);
&#125;
?>
So can anyone spot the error cos my head is starting to hurt!!! :wink:
[]InTeR[]
Forum Regular
Posts: 416
Joined: Thu Apr 24, 2003 6:51 am
Location: The Netherlands

Post by []InTeR[] »

2 thinks

Code: Select all

echo "<BODY>First Name:", $_POST&#1111;'first'],"<br>"; 
   echo "Last Name:",  $_POST&#1111;'last'],"<br>"; 
   echo "Address:",$_POST&#1111;'address'],"<br>"; 
   echo "Position:", $_POST&#1111;'position'], "<br><br></BODY>";
Have , instead of . to connect strings.

And

$sql ="INSERT INTO employees (first, last, address, position) VALUES ('$first',$last','$address','$position')";

misses a '

$sql ="INSERT INTO employees (first, last, address, position) VALUES ('$first','$last','$address','$position')";
User avatar
Skittlewidth
Forum Contributor
Posts: 389
Joined: Wed Nov 06, 2002 9:18 am
Location: Kent, UK

Post by Skittlewidth »

those are , and not . ! :)

but well spotted about the ' that's probably the thing.

I've got a load of deadlines at the moment so I don't really have time to read other people's scripts properly when I don't know what I'm looking for, so cheeers for that. I'll let you know if that solved it! :D
User avatar
Skittlewidth
Forum Contributor
Posts: 389
Joined: Wed Nov 06, 2002 9:18 am
Location: Kent, UK

Post by Skittlewidth »

Yep it was all down to a single '

Now I can have a lunch break!!!
Post Reply