473,387 Members | 1,669 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

can't insert value getting error: Function name must be a string

please check this codes i am not able to enter values to my created database through php code!


enterinfo.php
Expand|Select|Wrap|Line Numbers
  1. <form action="insertinfo.php" method="post">
  2. <table cellspacing="1" cellpadding="3">
  3. <tr><td>cityname:</td><td><input type="text" size="20" name="cityname"></td></tr>
  4. <tr><td>area:</td><td><input type="text" size="50" name="area"></td></tr>
  5. <tr><td>population:</td><td><input type="text" size="20" name="population"></td></tr>
  6. <tr><td><input type="submit" name="submit" value="submit"></td></tr>
  7. </table>
  8. </form>
insertinfo.php

Expand|Select|Wrap|Line Numbers
  1. <?php
  2.  $con=mysql_connect("localhost","root","cjalwaysrocks")   or die("please check connection");
  3. mysql_select_db("country");
  4. $cityname=$_POST('cityname');
  5. $area=$_POST('area');
  6. $population=$_POST('population');
  7.  
  8. $sql="INSERT INTO city(cityname,area,population) VALUES('$cityname','$area','$population')";
  9.  
  10. $result=mysql_query($sql) or die(mysql_error());
  11. echo "record successfully saved!"
  12.  
  13. ?>
  14.  
Fatal error: Function name must be a string
location:\insertinfo.php:0
May 12 '13 #1

✓ answered by Luuk

this is wrong:
Expand|Select|Wrap|Line Numbers
  1. $cityname=$_POST('cityname');
replace it with:
Expand|Select|Wrap|Line Numbers
  1. $cityname=$_POST['cityname'];
of course, also in the next lines where you use $_POST
more info here:
http://php.net/manual/en/reserved.variables.post.php

1 1596
Luuk
1,047 Expert 1GB
this is wrong:
Expand|Select|Wrap|Line Numbers
  1. $cityname=$_POST('cityname');
replace it with:
Expand|Select|Wrap|Line Numbers
  1. $cityname=$_POST['cityname'];
of course, also in the next lines where you use $_POST
more info here:
http://php.net/manual/en/reserved.variables.post.php
May 12 '13 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Chris Gilbert | last post by:
I'm quite stuck with this: I have an import table called ReferenceMatchingImport which contains data that has been sucked from a data submission. The contents of this table have to be imported...
7
by: Gil | last post by:
trying to use a template in a vector, in Visual Studio 6 on Windows 2000 #include <vector> using namespace std; template <typename T> class AnyValue { T val;
1
by: bagya | last post by:
please help me out the following is the small code i have <html> <head> <script type="text/javascript"> function validate() { if (document.abc.region.value==0)
1
by: imranabdulaziz | last post by:
Dear All, I am using sql2005. i am writing stored procedure to save various master data . I recognize master by @type (input verible) and assign it to @mst veriable then based on @mst no I...
1
Fary4u
by: Fary4u | last post by:
Hi is any body know where is actual problem is coz it's look me some problem ? to insert value into the MS ACCESS DATABASE after the value is true form html <input type="checkbox"...
21
vikas251074
by: vikas251074 | last post by:
I am getting error while entry in userid field. When user enter his user id, an event is fired immediately and user id is verified using AJAX method. But I am getting error 'Object doesn't support...
2
by: sony.m.2007 | last post by:
Hi, When i try to set a value for a session variable I'm getting a object refence not set error I tried two methods as below HttpContext.Current.Session.Add("AppStartTime", DateTime.Now);...
1
by: ghjk | last post by:
I'm a new to postgres. i have a table which is having a colomn with auto increment value. When I insert value to that table, it gives an error. First column is the auto increment one....
1
by: Omendra | last post by:
Hi, I am using SQL Server 2005 and i am using Stored Procedure something like :- I am getting error:- Msg 170, Level 15, State 1, Line 18: Incorrect syntax near 'MAX'. DECLARE @jid AS...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.