Jump to content


Photo

Simple data entry form


  • Please log in to reply
5 replies to this topic

#1 izzy

izzy
  • Members
  • PipPipPip
  • Advanced Member
  • 31 posts

Posted 30 June 2006 - 08:40 AM

I'm trying to make a very simple form that places information in my database.
I used a part of an existing script i have made some time ago.

All i'm getting is a blanc page once i submit the form.

Can someone tell me what is going wrong?
Here is the code from the different scripts.

This is the form:

<html>
<head>
<title>Add a link or banner to the directory</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="hotbabevote.css" type="text/css">
</head>

<body bgcolor="#FFFFFF" text="#000000" class="stdheaderconfig"><p><br>
<p><br>
  <span class="infosmallconfig">Use this form to add you link/banner to the directory. </span></p>
<form action=entry.php method=post enctype="multipart/form-data">
  <table width="700" border="0" cellspacing="2" cellpadding="2">
    <tr valign="middle" bgcolor="F9F9F9">
      <td class="stdtextconfig" width="122">Last Name:</td>
      <td width="564">
        <input type="text" name="lastname" size="45">
      </td>
    </tr>
    <tr valign="middle" bgcolor="F9F9F9">
      <td class="stdtextconfig" width="122">First Name:</td>
      <td width="564">
        <input type="text" name="firstname" size="45">
      </td>
    </tr>
    <tr valign="middle" bgcolor="F9F9F9">
      <td class="stdtextconfig" width="122">Company Name:</td>
      <td width="564">
        <input type="text" name="company" size="45">
      </td>
    </tr>
    <tr valign="middle" bgcolor="F9F9F9">
      <td class="stdtextconfig" width="122">Company URL:</td>
      <td width="564">
        <input type="text" name="companyurl" size="45"><br>
        (ie.  http://www.myfashionshop.com )
      </td>
    </tr>
    <tr valign="middle" bgcolor="F9F9F9">
      <td class="stdtextconfig" width="122">Business Description:</td>
      <td width="564">
        <input type="text" name="description" size="45">
      </td>
    </tr>
    <tr valign="middle" bgcolor="F9F9F9">
      <td class="stdtextconfig" width="122">Country:</td>
      <td width="564">
        <input type="text" name="country" size="45">
      </td>
    </tr>
    <tr valign="middle" bgcolor="F9F9F9">
      <td class="stdtextconfig" width="122">City/State:</td>
      <td width="564">
        <input type="text" name="city" size="45">
      </td>
    </tr>
    <tr valign="middle" bgcolor="F9F9F9">
      <td class="stdtextconfig" width="122">Sales Rep. Name:</td>
      <td width="564">
        <input type="text" name="repname" size="45">
      </td>
    </tr>
    <tr valign="middle" bgcolor="F9F9F9">
      <td class="stdtextconfig" width="122">Banner upload:</td>
      <td class="stdtextconfig" width="564">
        <input type="file" name="fotopath">
      </td>
    </tr>
    <tr bgcolor="F9F9F9">
      <td colspan="2">
        <div align="center">
          <input type="hidden" name="action" value="insert">
          <input type="submit" name="Submit" value="OK">
        </div>
      </td>
    </tr>
  </table>
</form>
<p>&nbsp; </p>
</body>
</html>


here is the script that is supposed to enter the info into the database:

//Een verbinding met de database maken
include("system/connect.inc.php");

//parameters lezen
if(isset($_GET['action'])) $action=$_GET['action'];
if(isset($_POST['action'])) $action=$_POST['action'];


if(isset($_REQUEST['action'])) $action=$_REQUEST['action'];

//Hier worden nieuwe huizen toegevoegd
if($action=="insert"){
//parameters lezen
$last_name=$_POST['lastname'];
$first_name=$_POST['firstname'];
$company_name=$_POST['company'];
$company_url=$_POST['companyurl'];
$link_description=$_POST['description'];
$link_country=$_POST['country'];
$link_city=$_POST['city'];
$rep_name=$_POST['repname'];

if($_FILES['fotopath']['size']>0){
//Eventueel nieuwe afbeelding uploaden
$source=$_FILES['fotopath']['tmp_name'];
$afbeeldingnaam=time() . $_FILES['fotopath']['name'];
//URL samenstellen
$dest="banners/" . $afbeeldingnaam;
$check1=copy($source,$dest);
}

$link_SQL_insert="INSERT INTO linkdir (lastname,firstname,company,companyurl,description,country,city,repname,fotopath) VALUES ('$last_name','$first_name','$company_name','$company_url','$link_description','$link_country','$link_city','$rep_name','$afbeeldingnaam')";
}



Here is the page that is supposed to show the records.

//Een verbinding met de database maken
include("system/connect.inc.php");

$link_SQL="SELECT * FROM linkdir ORDER BY firstname";
$link_result=mysql_query($link_SQL);

//In dit deel worden de gegevens weergegeven
while($link=mysql_fetch_array($link_result)){
//afbeelding voorbereiden
$img="";
if($link['fotopath']) $img="<img width=150 height=150 src='../banners/" . $link['fotopath'] . "'>";

?>

<table width="410" border="0">
<tr>
<td width="100">Last Name: </td>
  <td>
    <span><?php echo $link['firstname']?></span>
  </td>
</tr>
<tr>
<td width="100">First Name: </td>
  <td>
    <span><?php echo $link['firstname']?></span>
  </td>
</tr>
<tr>
<td>Company: </td>
  <td>
    <span><?php echo $link['company']?></span>
  </td>
</tr>
<tr>
<td>Company URL: </td>
  <td>
    <span><?php echo $link['companyurl']?></span>
  </td>
</tr>
<tr>
<td>Description: </td>
  <td>
    <span><?php echo $link['description']?></span>
  </td>
</tr>
<tr>
<td>Country: </td>
  <td>
    <span><?php echo $link['country']?></span>
  </td>
</tr>
<tr>
<td>City/State: </td>
  <td>
    <span><?php echo $link['city']?></span>
  </td>
</tr>
<tr>
<td>Rep. Name: </td>
  <td>
    <span><?php echo $link['repname']?></span>
  </td>
</tr>
      </table>
    <td width="200">   
      <span><?php echo $img?></span>
  </td>
</table>
<p><p></p></p>
<?php
}
mysql_close
?>

Help me please, This is supposed to be simple... :-(

#2 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 30 June 2006 - 09:08 AM

method="post" action=" " ect .................


" "<<<<<<<<<<where the in the form.
Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#3 Monshery

Monshery
  • Members
  • PipPipPip
  • Advanced Member
  • 44 posts

Posted 30 June 2006 - 09:13 AM

Your missing " " on your form opening .
<form action=entry.php method=post enctype="multipart/form-data">
  <table width="700" border="0" cellspacing="2" cellpadding="2">
sould be

<form action="entry.php" method="post" enctype="multipart/form-data">
  <table width="700" border="0" cellspacing="2" cellpadding="2">
Remmber if you use post without caps lock remmber to use it without in you php tags. or anywhere else.


#4 Monshery

Monshery
  • Members
  • PipPipPip
  • Advanced Member
  • 44 posts

Posted 30 June 2006 - 09:21 AM

once more thinks
if(isset($_GET['action'])) $action=$_GET['action'];
if(isset($_POST['action'])) $action=$_POST['action'];

use $_GET/$_POST - in lower case since you use it as small case on your form
like this
$_get/$_post . or
go to your form begining and in method  change it to method="POST" not method="post"

#5 izzy

izzy
  • Members
  • PipPipPip
  • Advanced Member
  • 31 posts

Posted 30 June 2006 - 10:41 AM

Thanks
But still nothing has changed.

I keep looking over the scripts but i can't see the problem  ??? >:(

HELP !!!

#6 izzy

izzy
  • Members
  • PipPipPip
  • Advanced Member
  • 31 posts

Posted 30 June 2006 - 11:01 AM

Sorry everyone...

Database connection wasn't good...

:-[




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users