PHP newbie help needed

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

New php-forum User
New php-forum User
Posts: 2
Joined: Tue May 20, 2014 10:04 am

PHP newbie help needed

Postby flashybee » Tue May 20, 2014 10:10 am

I just follow one php tutorials wherein there is a html form and when the "ok" button will be pressed the insert query will be printed. 'Though I follow the tutorials it will not do the same as expected. Do anybody have some time to look into the code where I am gong wrong. I am new in PHP.

Code: Select all



mysql_select_db($dbname,$testConnect)  or die (mysql_error());
// creating table

/*$sql= "CREATE TABLE `user`.`example`
         `firstname` VARCHAR(64) NOT NULL,
         `lastname` VARCHAR(64) NOT NULL,
          `region_name` INT ,
         `ssnumber` INT ,
         `age` INT)
          ENGINE = MyISAM;";
         mysql_query($sql) or die (mysql_error());
         print "Table Created  Successfully";
         // inserting values in the table
   print("This is the value");
$sqlInsert = "INSERT INTO  'user' . `example`(
                  VALUES ('Tarun', 'Ghosh', 1, 44,54)";


//mysql_query($sqlInsert) or die (mysql_error());

$sqlReg = "SELECT regionName,regionNumber FROM  regions";
$Result = mysql_query($sqlReg,$testConnect) or die (mysql_error());

    /*$row_nameCheck =mysql_fetch_assoc($Result);

   $firstNameValue = $row_nameCheck['regionName'];
   $middleNameValue = $row_nameCheck['regionNumber'];

    echo "This is the First Name:- $firstNameValue <br>";
    echo "This is the MIddle Name :- $middleNameValue <br>";*/
//$myrow = mysql_fetch_array($Result);

//echo $myrow['regionNumber'];



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>


<form id="enterForm" name="dateEnter" method="post" action="index.php?function=add">
Enter First Name: <input type="text" name="name" id="name"/><br />
Enter Last Name : <input type="text" name="lastname" id="lastname"/><br />
Select Region Number:
<select name="regionNumber"id="regionNumber">
   <?php while ($myRow = mysql_fetch_array($Result)){ ?>
   <option value="<?php echo $myRow['regionNumber'];?>"><?php echo $myRow['regionNumber']. "-" .$myRow['regionName']; ?></option>
   <?php } ?>

Please Enter SS Number No Dashes:
<input type="text" name="ssnumber" id="ssnumber"/><br/>
Enter your age : <input type="text" name="age" id="age"/><br />
<input type="submit" name="addData" id="addData" value="Ok" />


If the question is not clear, Please ask and I will elaborate it.



New php-forum User
New php-forum User
Posts: 2
Joined: Tue May 20, 2014 10:04 am

Re: PHP newbie help needed

Postby flashybee » Wed May 21, 2014 5:56 am

No body here to respond?

Return to “PHP coding => General”

Who is online

Users browsing this forum: No registered users and 6 guests