-1

Hi I'm really new to programming I mean really new so before answering, think in the mind of a programming n00b! Anyway, more to the point in PHP I'm trying to create an account system so every time someone fills in an HTML form it automatically creates a new variable. The new variable would obviously be what they entered and possibly would be called something like $user147 for example. Any help much appreciated!

  • I think your confused about variable scope - normally they last for less than the duration of the request and aren't shared between requests. PHP writes html. – symcbean Feb 02 '12 at 21:40
  • I don't know what I'm getting confused with :/ – user1186197 Feb 02 '12 at 21:42
  • 1
    Your question just doesn't make any sense. Please at least get some BASIC knowledge of the programming language you want to use, before asking things like this. – Vultour Feb 02 '12 at 21:49

3 Answers3

1

Well, a good start would be reading the manual. That's aside, you should learn about SQL and how to make and use tables.

My advice to you is this: get reading, try it out, if you get stuck along the way, come back here and ask. No one here will write code for you.

Madara's Ghost
  • 172,118
  • 50
  • 264
  • 308
  • I'm not asking for code, all I want is to know how to randomly generate a variable name. But thanks for your answer anyway. – user1186197 Feb 02 '12 at 21:41
  • You're not making sense. How would a randomly named variable ever help you with a user registration system? You need a more permanent place (such as a database) to save the user details. The variable will not persist once the page is finished loading. – Madara's Ghost Feb 02 '12 at 21:42
  • I suppose so. Thanks and sorry! By the way do you know any good database/SQL tutorials? – user1186197 Feb 02 '12 at 21:43
1

Probably bad practice, however what you are trying to do is possible:

$var = $_GET['user147'];
$$var = $var;

now you have a variable named $user147 that contains the string 'user147'

James L.
  • 4,032
  • 1
  • 15
  • 15
0

Go to the PHP website and read about the $_REQUEST superglobal. http://www.php.net/manual/en/reserved.variables.request.php

Don't use random variable names, as it is poor practice.

siliconwafer
  • 732
  • 4
  • 9