Web Design Forum: PHP server form. - Web Design Forum

Jump to content

WDF
WDF Premium Memberships Reseller Hosting
Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

PHP server form. I need help with this form that puts database infromation into a serve

#1 User is offline   wolf125 

  • Forum Newcomer
  • Pip
  • Group: Members
  • Posts: 68
  • Joined: 12-May 11
  • Reputation: 0
  • Gender:Male
  • Experience:Beginner
  • Area of Expertise:I'm Learning

Posted 29 August 2011 - 05:34 PM

I have a new problem. Man i seem to be full of them. anyways i have a php code that is written like this:

<?php

//validate important input
if ((!$_POST[table_name]) || (!$_POST[num_fields])) {
header( "Location: show_createtable.html");
exit;
}

//begin creating form for display
$form_block = "
<form method=\"post\" action=\"do_createtable.php\">
<input type=\"hidden\" name=\"table_name\" value=\"$_POST[table_name]\">
<table cellspacing=5 cellpadding=5>
<tr>
<th>FIELD NAME</th><th>FIELD TYPE</th><th>FIELD LENGTH</th></tr>";

//count from 0 until you reach the number of fields
for ($i = 0; $i <$_POST[num_fields]; $i++) {
//add to the form, one row for each field
$form_block .= "
<tr>
<td align=center>
<input type=\"text\" name=\"field_name[]\" size=\"30\"></td>
<td align=center>
<select name=\"field_type[]\">
<option value=\"char\">char</option>
<option value=\"date\">date</option>
<option value=\"float\">float</option>
<option value=\"int\">int</option>
<option value=\"text\">text</options>
<option value=\"varchar\">varchar</options>
</select>
</td>
<td align=center>
<input type=\"text\" name=\"field_length[]\" size=\"5\"></td>
</tr>";
}

//finish up the form
$form_block .= "
<tr>
<td align=center colspan=3><input type=\"submit\" value=\"Create Table\"></td>
</tr>
</table>
</form>";

?>
<html>
<head>

<title>Create a Database Table: Step 2</title>

</head>
<body>

<h1>Define fields for <?php echo "$_POST[table_name]"; ?></h1>

<?php echo "$form_block"; ?>

</body>
</html>

and i get this:

//that below is in a box <-not part of the code or anything
\"$_POST[table_name]\ "; //count from 0 until you reach the number of fields for ($i = 0; $i <$_POST[num_fields]; $i++) { //add to the form, one row for each field $form_block .= " "; } //finish up the form $form_block .= "

FIELD NAME FIELD TYPE FIELD LENGTH
box box(with field types in it) box

box(with: \"Create )
"; ?>
Define fields for



That's all i get.

This post has been edited by wolf125: 29 August 2011 - 05:35 PM

0

#2 User is offline   wolf125 

  • Forum Newcomer
  • Pip
  • Group: Members
  • Posts: 68
  • Joined: 12-May 11
  • Reputation: 0
  • Gender:Male
  • Experience:Beginner
  • Area of Expertise:I'm Learning

Posted 29 August 2011 - 05:36 PM

I've checked for errors and found a few, but I haven't caught the error or errors doing this.
0

#3 User is offline   wolf125 

  • Forum Newcomer
  • Pip
  • Group: Members
  • Posts: 68
  • Joined: 12-May 11
  • Reputation: 0
  • Gender:Male
  • Experience:Beginner
  • Area of Expertise:I'm Learning

Posted 01 September 2011 - 07:57 PM

never mind. the only problem wasn't in the code. i either didnt have any php version, i had an outdated version, or it was just because i wasnt checking through the right address.
0

#4 User is online   Samus 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 289
  • Joined: 05-August 11
  • Reputation: 19
  • Gender:Male
  • Location:Hackney, London, UK
  • Experience:Intermediate
  • Area of Expertise:Web Developer

Posted 03 September 2011 - 11:24 PM

I think the problem is in the code..

What the hell is this?!

 <?php echo "$_POST[table_name]"; ?>


Change plox:

 <?php echo $_POST['table_name']; ?>

0

#5 User is offline   wolf125 

  • Forum Newcomer
  • Pip
  • Group: Members
  • Posts: 68
  • Joined: 12-May 11
  • Reputation: 0
  • Gender:Male
  • Experience:Beginner
  • Area of Expertise:I'm Learning

Posted 13 September 2011 - 08:04 PM

View PostSamus, on 03 September 2011 - 11:24 PM, said:

I think the problem is in the code..

What the hell is this?!

 <?php echo "$_POST[table_name]"; ?>


Change plox:

 <?php echo $_POST['table_name']; ?>


What in the world is a plox?
0

#6 User is offline   wolf125 

  • Forum Newcomer
  • Pip
  • Group: Members
  • Posts: 68
  • Joined: 12-May 11
  • Reputation: 0
  • Gender:Male
  • Experience:Beginner
  • Area of Expertise:I'm Learning

Posted 13 September 2011 - 08:06 PM

whatever the problem was, there were a lot by the way, although not after i sent it in. i did get it fixed. Thank you all for your help.
0

#7 User is online   Samus 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 289
  • Joined: 05-August 11
  • Reputation: 19
  • Gender:Male
  • Location:Hackney, London, UK
  • Experience:Intermediate
  • Area of Expertise:Web Developer

Posted 21 September 2011 - 10:08 PM

View Postwolf125, on 13 September 2011 - 08:04 PM, said:

What in the world is a plox?

teen internet gangster language for 'please' :p
0

#8 User is offline   wolf125 

  • Forum Newcomer
  • Pip
  • Group: Members
  • Posts: 68
  • Joined: 12-May 11
  • Reputation: 0
  • Gender:Male
  • Experience:Beginner
  • Area of Expertise:I'm Learning

Posted 12 October 2011 - 07:47 PM

View PostSamus, on 21 September 2011 - 10:08 PM, said:

teen internet gangster language for 'please' :p


wow. now i know. thanks
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users