Loop variable error

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
reecec
Forum Contributor
Posts: 218
Joined: Sun Apr 02, 2006 7:12 am

Loop variable error

Post by reecec »

Hi all

it doesnt like the variable and gives the T_VARIABLE error any ideas

Code: Select all

<?php
$table=$_POST['tbname'];
if ($_POST['form_create_table'] == 'yes'){
$endfield=1;
while ( $endfield <= $howmanyfields ) {
$field$endfield=$_POST['field$endfield'];
$endfield++;
}
$endfield=1;
while ( $endfield <= $howmanyfields ) {
$length$endfield=$_POST['length$endfield'];
$endfield++;
}
$endfield=1;
while ( $endfield <= $howmanyfields ) {
$attribute$endfield=$_POST['attribute1$endfield'];
$endfield++;
}
$endfield=1;
while ( $endfield <= $howmanyfields ) {
$null$endfield=$_POST['null$endfield'];
$endfield++;
}
$endfield=1;
while ( $endfield <= $howmanyfields ) {
$default$endfield=$_POST['default$endfield'];
$endfield++;
}
$endfield=1;
while ( $endfield <= $howmanyfields ) {
$extra$endfield=$_POST['extra$endfield'];
$endfield++;
}

$endfield=1;
$maketable="CREATE TABLE $_POST['tbname'];(
while ( $endfield <= $howmanyfields ) {

$field$end varchar($length$end) $null$end $default$end '',
$endfield++;
}

thanks reece
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

reecec
Forum Contributor
Posts: 218
Joined: Sun Apr 02, 2006 7:12 am

Post by reecec »

please can you give me an example of where i would put a variable variable as i have read about them but dont know where to put them on my code to stop my error

thanks reece
Post Reply