I have some code for drop down its not working it gives the errors every thing looks fine to me help me out.
Errors - Notice: Undefined index: from in C:\wamp\www\site\booking.php on line 6
-
-
Notice: Undefined index: to in C:\wamp\www\site\booking.php on line 8
-
-
Notice: Undefined index: couch in C:\wamp\www\site\booking.php on line 10
-
-
Notice: Undefined index: 550 in C:\wamp\www\site\booking.php on line 12
-
Error Cannnot Insert Records!
PHP CODE: - <?php
-
-
-
if(isset($_POST['submit']))
-
{
-
$a = $_POST['from'];
-
-
$b = $_POST['to'];
-
-
$c = $_POST['couch'];
-
-
$d = $_POST['550'];
-
-
-
-
mysql_connect("localhost", "root", "password") or die ('Error'.mysql_error());
-
-
mysql_select_db("online_bus_project");
-
-
-
$query="INSERT INTO trip (from,to,coach_type,fare) values ('$a','$b','$c')";
-
-
-
-
mysql_query($query) or die ('Error Cannnot Insert Records!');
-
-
}
-
-
?>
HTML CODE: - <div id="status"><form name="status" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
-
<br>
-
<br>
-
<br>
-
<table class="note" width="90%" align="center" border="0" cellpadding="2" cellspacing="2">
-
<tbody><tr>
-
<td colspan="4" class="header" width="100%" align="center"><font size="4" color="royalblue" face="Verdana, Arial, Helvetica, sans-serif"><b class="heading"><span class="header"><font color="#336699">Welcome
-
To Online B<span class="heading"><span class="heading">us Reservation</span></span></font></span><br>
-
</b><font size="2" color="#ff0000">Please Select your date of departure and destination to proceed ahead with the booking.</font><font size="2" color="#000000">
-
</font></font></td>
-
</tr>
-
<tr>
-
<td colspan="4" width="100%"> </td>
-
</tr>
-
-
-
-
<tr>
-
-
-
<td font="" face="Verdana, Arial, Helvetica, sans-serif" size="2" width="25%" align="left" height="30">
-
<center>
-
-
<br /><center> <strong>From:</strong>
-
*****<select id="from">
-
-
<option value = "karachi">Karachi</option>
-
-
<option value = "sukkur">Sukkur</option>
-
-
</select>
-
<center><br />
-
<strong>To:</strong>**********
-
<select id="to"></center>
-
-
<option value = "sukkur">Sukkur</option>
-
-
<option value = "karachi">Karachi</option>
-
</select>
-
-
<center><br /><strong>Couch:***</strong>
-
<select id="couch"></center>
-
-
<option value = "nonac">NonAC</option>
-
-
<option value = "ac">AC</option>
-
</select>
-
-
</select>
-
-
-
-
<!--
-
<tr>
-
<td width="100%" colspan=4> </td>
-
</tr>
-
-->
-
<tr>
-
<td colspan="4" width="100%"><hr width="95%" align="left" noshade="noshade"></td>
-
</tr>
-
-
-
<tr>
-
<td colspan="4" width="100%" align="center">
-
-
-
<input type="submit" value="Submit" name="submit">
-
</form>
19 9095 Dormilich 8,658
Recognized Expert Moderator Expert
add the mentioned indices as name attribute.
ex. - <select name="from" id="from">
thanx for the help DORMILICH so many errors gone by adding name.
But what about
its not in the list i want this to be inserted that's the rent its same for all.
Error: - Notice: Undefined index: 550 in C:\wamp\www\site\booking.php on line 12
-
Error Cannnot Insert Records!
Markus 6,050
Recognized Expert Expert
Declare $d's value yourself then.
Declared $d value its not working same error but removing this by removing $d value it also gives error message !cannot insert record -
$query="INSERT INTO trip (from,to,coach_type,fare) values ('$a','$b','$c','$d')";
-
This one - mysql_query($query) or die ('Error Cannnot Insert Records!');
Markus 6,050
Recognized Expert Expert @obtrs
Patience is a virtue.
add mysql_error() to your die() call. If there's a mysql error, it'll give you the info. -
mysql_query(...) or die(mysql_error());
-
Please note: for lack of a better term, Bytes.com is a privilege, not a right. Until you start paying us cash, you'll have to wait until one of our kind experts takes time out of his day to give you help.
Moderator.
Patience is a virtue.
sorry my bad
same 550 fare error even i have declared it in $query - $query="INSERT INTO trip (from,to,coach_type,fare) values ('$a','$b','$c','$d')";
the last one $d.
Error - Notice: Undefined index: 550 in C:\wamp\www\site\booking.php on line 12
-
You have an error in your SQL syntax; from,to,coach_type,fare)values ('karachi','sukkur','nonac','')' at line 1
database has the same value as shown from,to,coach_t ype,fare
line 12 in which the error showing:
its showing that the 550 is empty ' ' i have declare it do i have to declare it any where else too?
Markus 6,050
Recognized Expert Expert
You haven't declared it. You point it to a none-existent index in the POST array.
When I said 'declare its value yourself', I meant assign it's value (550) because you said that was a constant. Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Paul Fairless |
last post by:
Customers table - contains Columns:
CustID, Surname, Forename, TtlID
Titles table - contains Columns:
TtlID, Title
TtlID is a Foreign Key in the Customers table.
I have a Form frmCustomers which contains a ComboBox to select
the Customer's Title. The ComboBox is populated from the database
|
by: John Tyce |
last post by:
When a button is clicked, a date is inserted or added into a combo box like this : ComboBox.Items.Add(string) or ComboBox.Items.Insert(0,string);
Either way, the new string does not show up in the ComboBox. I get no errors or problems, it just will not work. At load time I am retrieving dates from an Oracle database and adding them to the...
|
by: Support |
last post by:
Hi All,
I am working in VB.NET.
I have a data bound control (combobox) which I want to fill with a certain
field of my table from database ( SQL as backend).
The issue is, I want these values to fill the combo at the index specified
by me, ie, not the usual 0,1,2.... by default. Also, not dataset, but I am
using dataReader.
Can anyone send...
|
by: SKarnis |
last post by:
We are trying to rebuild a current Access 2002 (XP) mdb program to VB.NET
with a SQL database - we are having problems with a suitable combobox.
There are many threads discussing multiple column comboboxes in .NET. We
are having success with the multiple columns similar to the combobox from
Access 2002 (XP).
Our biggest problem is speed. ...
|
by: Steve B. |
last post by:
Without adding whitespace to the ComboBox datasource is there a way I can add
a blank entry or, a reset entry, to the ComboBox dropdown
Thanks
Steve
| |
by: reloader |
last post by:
Hi all,
I would like to ask you about combobox refershing. My code is:
<title>none</title>
<body>
<table border="1" width="100%" cellspacing="0" cellpadding="2">
<%
dim m_DB
|
by: amber |
last post by:
I'm having an issue with a combobox that is making no sense to me at all.
I have a form with several comboboxes/textboxes.
The values in these boxes are based on a datarowview, which is based on a
listbox.selecteditem.
When a different item is selected in the listbox, all the fields are
repopulated with the correct data.
I have 1...
|
by: Frnak McKenney |
last post by:
Can I use a bound ComboBox for both browsing and editing?
I'm working on a small, standalone database application using Visual
C#.NET 2003 and an Access data file.
In order to keep the number of different screens down to a minimum,
I'm trying to use the same Windows Forms for both browsing and for
updating. This works fine for TextBoxes,...
|
by: Przemek M. Zawada |
last post by:
Dear Group,
I'm developing sample window form, using DataGridView control, which
is filled with data through BindingSource, which is based on type of
object, as follow:
public sampleClass
{
public int itemNumber;
public string itemName;
|
by: sivadhanekula |
last post by:
Hi everyone..
I want to insert a combobox with the list of test names of a database, but the testname contains 15000+ data, and I cant type all the data. so can any one help me in writing an SQL statement, so that if I give that statement it will automatically swaps the table names to the combobox.
P.S I know the SQL statement but I dono...
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
| |
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it. ...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |