Jump to content

Recommended Posts

tested it on a free account i just set up with a different provider, i get the same results.. its not the form thing :(

 

heres both files so far

 

the PHP

<?php echo "form submitted"; ?>
<?
include("dbinfo.inc.php");
mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die(mysql_error());

foreach ($_POST as $key => $val)
      echo "key :: $key  =>  value :: $val <br />";

$bedrooms=$_POST['bedrooms'];
$bathrooms=$_POST['bathrooms'];
$area=$_POST['area'];
$postcode=$_POST['postcode'];
$ref=$_POST['ref'];
$description=$_POST['description'];
$rentpw=$_POST['rentpw'];
$rentpm=$_POST['rentpm'];
$deposit=$_POST['deposit'];
$propertynear=$_POST['propertynear'];
$availability=$_POST['availability'];
$type=$_POST['type'];
$address=$_POST['address'];
$image=$_POST['image'];

$query = "INSERT INTO lettings VALUES ('','$bedrooms','$bathrooms','$area','$postcode','$ref','$description','$rentpw','$rentpm','$deposit','$propertynear','$availability','$type','$address','$image')";
mysql_query($query);
?>
<br>
<?

echo($query);
mysql_close();
?> 

 

the form

<form action="insert.php">
bedrooms: <input type="text" name="bedrooms"><br>
bathrooms: <input type="text" name="bathrooms"><br>
area: <input type="text" name="area"><br>
postcode: <input type="text" name="postcode"><br>
ref: <input type="text" name="ref"><br>
description:<input type="text" name="description"><br>
rent pw: <input type="text" name="rentpw"><br>
rentpm: <input type="text" name="rentpm"><br>
deposit: <input type="text" name="deposit"><br>
availability: <input type="text" name="availability"><br>
type: <input type="text" name="type"><br>
address: <input type="text" name="address"><br>
image: <input type="text" name="image"><br>
<input type="submit" method="post">
</form>

 

all im getting is

INSERT INTO lettings VALUES ('','','','','','','','','','','','','','','')

 

by the way, i think the form is working fine as when i submit the url has all this in it

 

/insert.php?bedrooms=4&bathrooms=1&area=leeds&postcode=LS9+0NN&ref=JDU7362&description=nice+place+to+live&rentpw=50&rentpm=500&deposit=500&availability=2009-01-01&type=flat&address=112+moon&image=http%3A%2F%2Fhealth.discovery.com%2Fcenters%2Fkids%2Fchildproof%2Fimages%2Fhouse_off.gif

ah ;), little mistake there on your html form tag, make sure you express method="post".

 

ie:

 

<form action="insert.php" method="post">

 

when ou get a URL like that it means your sending a GET query, accessible via the $_GET global.

you know what, i have got no idea at all. i've been chopping and changing things half asleep for a few hours now just getting more and more frustrated - i dont actually remember doing it..

 

time for some food and bed.. thanks to all that have helped me on my posts today all the input has helped alot.. and um.. yeah.. sorry for being blonde lol

 

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.