Jump to content

php mysql entering data in database - does not post to db


tylrwb

Recommended Posts

I am having a little problem with my php page I have a simple area to icert data - only it does not incert the data. I have not encountered this before. I cannot see anything wrong with it but, maybe someone else can. connection to the database is already made at this point at the top of my page. It does connect and the date is entered but nothing else?

Here is the code:

 

<?php

if (isset($_REQUEST['Submit']))

{

$date = date("Y-m-d");

$sql = "INSERT INTO ads(heading, body, date, author_name, author_email, link) VALUES('$heading', '$body', '$date', '$author_name', '$author_email', '$link')";

if($result = mysql_query($sql ,$db))

{

echo "Thank you, Your information has been entered into our database";

}

else

{

echo "ERROR: ".mysql_error();

}

 

}

else

{

 

?>

<p><h3>Enter your ad into the database</h3>

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

Name:     <input type="text" size="20" name="author_name"><p>

Email:      <input type="text" size="20" name="author_email"><p>

Heading:  <input type="text" size="20" name="heading"><p>

Description:<br>

<textarea cols=40 rows=10 name="body" wrap="virtual">

</textarea><p>

Full Link:  <input type="text" size="50" name="link"><p>

<input type="submit" name="Submit" value="Submit Ad!">

</form>

<?php

}

?>

 

thanks for everyone's help!

I kinda thought somthing like that but I am REQUESTING not POST

 

I get this

 

Fatal error: Function name must be a string in /home/srppur3/public_html/srp-design/test4.php on line 121

 

I entered this:

 

$heading = $_POST(heading);

Ok every thing is working fine now! I have another question if possable.

this page is on my web site - and they have to pay to fill that out.

How would you go about making it so the page cannot be accessed directly?

They will not be a member or anything and i dont want them to be.

Basically they go to a paypal page first and after payment they get to fill in the info.

But you can access the page directly if you know the address..

 

Thanks Again

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.