0

I am new to PHP, and have been trying to make this work but nothing.. basically i have a simple registration form

I would appreciate your help

user710502
  • 11,181
  • 29
  • 106
  • 161
  • 1
    Missed the bit on [not using `extract` on user-submitted data](http://php.net/manual/en/function.extract.php#refsect1-function.extract-notes) did you? (_the etc. **includes** $_POST as well_) Also, raw INSERTs from the form. [Another no-no] (http://stackoverflow.com/questions/129677/whats-the-best-method-for-sanitizing-user-input-with-php). **PS** I _believe_ it has to do with the top `` not split up). Remove that line and try again. – Brad Christie Oct 27 '11 at 04:16

2 Answers2

1

Off-hand I'd guess 1 of two things (both relating to display_errors being disabled, so you're not getting any reason why it's failing):

  1. Your print has an "unescaped" ?> in it, so my guess is the compiler sees it and thinks it's done with PHP code. Often when this header is output from php, it is done so in this fashion:
    <?php echo '<?xml ... ?'.'>'; ?>
    Note the . concatenating the two characters to avoid compiler confusion.
  2. Your print is missing a semicolon (;)

However, you also missed the bit on not using extract on user-submitted data

Do not use extract() on untrusted data, like user input (i.e. $_GET, $_FILES, etc.).

(The etc. above would include $_POST as well) extract() is not necessary for $_POST[] to be populated, so do yourself a favor and just use $_POST.

Also, raw INSERTs from the form are another no-no.

Community
  • 1
  • 1
Brad Christie
  • 100,477
  • 16
  • 156
  • 200
1

You should display PHP errors. Seems like PHP crashes on a half way, and we don't really know why. By the way U cant use the following array keys naming: $_POST[fname]. It should be $_POST['fname']

Turn displaying errors on using this:

ini_set('display_errors',1);

error_reporting(E_ALL);
fperet
  • 436
  • 8
  • 21
  • where do i do this? sorry i am new to php – user710502 Oct 27 '11 at 04:39
  • Just add the two lines of code to the beginning of your test.php. – Tobias Golbs Oct 27 '11 at 04:43
  • it gave me this error Fatal error: Call to undefined function mysql_connect() – user710502 Oct 27 '11 at 04:54
  • Your php don't use mysql extension. Find something that looks like this in your php.ini file -> ;extension=php_mysql.dll and remove ";". If this won't fix the problem you DO need to instal php with mysql extension, and turn extension on. – fperet Oct 27 '11 at 05:55
  • it is uncommented, also moved the php_mysql.dll to the C:/Windows/System32 and the libmysql.dll or something.. but nothing – user710502 Oct 27 '11 at 06:00
  • Make sure U're fixing right ini file. Check it with phpinfo() inside your script. It will show which ini file is loaded. Also if mysql extension is enabled, you'll see a mysql block in the info list. – fperet Oct 27 '11 at 07:12