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>
May 6 '09
19 9105
u mean that i have to use the value instead of variable $d i have to put direct 550 in values?
Dormilich 8,658
Recognized Expert Moderator Expert @obtrs
you don't have to put it directly in the SQL, but it's a good idea, esp. when the value doesn't change.
its not working either this way or that is there any thing wrong with the code? - <?php
-
-
-
if(isset($_POST['submit']))
-
{
-
$a = $_POST['from'];
-
-
$b = $_POST['to'];
-
-
$c = $_POST['couch'];
-
-
$d = $_POST['550'];
-
-
-
-
mysql_connect("localhost", "root", "autodeskmaya") or die ('Error'.mysql_error());
-
-
mysql_select_db("online_bus_project");
-
-
-
$query="INSERT INTO trip (from,to,coach_type,fare) values ('$a','$b','$c','$d')";
-
-
-
-
mysql_query($query) or die (mysql_error());
-
-
}
-
-
?>
-
-
-
-
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-
<html xmlns="http://www.w3.org/1999/xhtml">
-
<head>
-
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-
<title>Untitled Document</title>
-
<link href="obrs.css" rel="stylesheet" type="text/css" />
-
<!--[if IE 5]>
-
<style type="text/css">
-
/* place css box model fixes for IE 5* in this conditional comment */
-
.twoColFixRtHdr #sidebar1 { width: 220px; }
-
</style>
-
<![endif]--><!--[if IE]>
-
<style type="text/css">
-
/* place css fixes for all versions of IE in this conditional comment */
-
.twoColFixRtHdr #sidebar1 { padding-top: 30px; }
-
.twoColFixRtHdr #mainContent { zoom: 1; }
-
/* the above proprietary zoom property gives IE the hasLayout it needs to avoid several bugs */
-
</style>
-
<![endif]-->
-
<script src="Scripts/AC_RunActiveContent.js" type="text/javascript"></script>
-
<style type="text/css">
-
<!--
-
.style1 {
-
color: #FFFF00;
-
font-weight: bold;
-
}
-
.style2 {
-
color: #FFFF66;
-
font-weight: bold;
-
}
-
#apDiv1 {
-
position:absolute;
-
left:35px;
-
top:168px;
-
width:621px;
-
height:362px;
-
z-index:1;
-
}
-
-->
-
</style>
-
-
-
</head>
-
-
<body class="twoColFixRtHdr">
-
<div id="container">
-
<div id="header">
-
<!-- end #header -->
-
<img src="images/header" alt="OBTRS: Header" /></div>
-
<div id="sidebar1">
-
<!-- end #sidebar1 -->
-
<img src="images/sidebar_slideshow" alt="" />
-
<div id="blogarea">
-
<p class="style2">Casual Dining Restaurants</p>
-
<p><br />
-
Our family-style restaurants are the favorite of thousands of tourists and professional drivers alike. Our clean and friendly surroundings encourage people to stop and enjoy a wholesome meal with us when they travel. Our customers recognize our strong teamwork ethic as we provide them quality service.</p>
-
<p><br />
-
<span class="style1">Convenience Stores</span></p>
-
<p><br />
-
Our cashiers take pride in having the items on the shelf ready for our travelers when they stop. We know many are in a hurry and we need to be "fast" to meet their busy schedules. Some of our returning customers enjoy fresh coffee and we have it ready for them. The joint effort of our managers and associates creates a strong "team spirit" that provides the customers what they are looking for as they travel.</p>
-
</div>
-
</div>
-
<div id="mainContent">
-
<div id="nav">
-
<script type="text/javascript">
-
AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0','width','760','height','30','src','images/nav_bar2','quality','high','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','movie','images/nav_bar2' ); //end AC code
-
</script>
-
<noscript>
-
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="760" height="30">
-
<param name="movie" value="images/nav_bar2.swf">
-
<param name="quality" value="high" />
-
<embed src="images/nav_bar2.swf" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="760" height="30"></embed>
-
</object>
-
</noscript>
-
</div>
-
-
<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 name="from" id="from">
-
-
<option value = "karachi">Karachi</option>
-
-
<option value = "sukkur">Sukkur</option>
-
-
</select>
-
<center><br />
-
<strong>To:</strong>**********
-
<select name="to" id="to"></center>
-
-
<option value = "sukkur">Sukkur</option>
-
-
<option value = "karachi">Karachi</option>
-
</select>
-
-
<center><br /><strong>Couch:***</strong>
-
<select name="couch" 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>
-
</td>
-
</tr>
-
-
<tr>
-
<td colspan="4" align="center"> </td>
-
</tr>
-
-
<!--
-
<tr>
-
<td width="100%" align="center" colspan="4">
-
<div align="left" class="note">
-
<hr noshade width="95%" align="left">
-
<font face="Verdana, Arial, Helvetica, sans-serif" size="2"><font color="#000000"><br>
-
Note :</font></font> <span class="note">Please fill in your departure
-
and destination stations, number of seats required and the prefered
-
date of your journey in this page and click on "Check Status" </span></div>
-
</td>
-
</tr>
-
-->
-
-
</tbody></table>
-
-
</form></td>
-
</tr>
-
</tbody></table></div>
-
<div id="features"></div>
-
<!-- end #mainContent -->
-
</div>
-
<!-- This clearing element should immediately follow the #mainContent div in order to force the #container div to contain all child floats -->
-
<br class="clearfloat" />
-
<div id="footer">
-
<p><a href="aboutus.html">About us</a> |<a href="feedback.html"> Feedback</a> |<a href="faqs.html"> FAQs</a> | <a href="terms.html">Terms & Conditions</a> | <a href="contactus.html">Contact us</a></p>
-
<p> 2009 Copyright - Shah Abdul Latif University Khairpur</p>
-
<!-- end #footer -->
-
</div>
-
<!-- end #container -->
-
</div>
-
-
</body>
-
</html>
-
Markus 6,050
Recognized Expert Expert
Reread what I posted. You're still trying to assign $d to a variable that doesn't exist!
Change $d = $_POST['550'] to just $d = 550
<moderator note: i accidently overwrote the contents of this post>
Markus 6,050
Recognized Expert Expert
You're trying to insert into 4 columns but only providing 3 values. Try something like -
INSERT INTO `table` ('from, to, coach_type, fare) VALUES ('sukkur', 'karachi', 'nonac')
-
tried every thing just stuck with this error i have deleted some unnecessary things now i have this code with same error:
PHP CODE: - <?php
-
-
-
if(isset($_POST['submit']))
-
{
-
$a = $_POST['from'];
-
-
$b = $_POST['to'];
-
-
-
-
-
-
-
-
mysql_connect("localhost", "root", "password") or die ('Error'.mysql_error());
-
-
mysql_select_db("online_bus_project");
-
-
-
$query="INSERT INTO trip (from,to) values ('$a','$b')";
-
-
-
-
mysql_query($query) or die (mysql_error());
-
-
}
-
-
?>
HTML CODE: - <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 name="from" id="from">
-
-
<option value = "karachi">Karachi</option>
-
-
<option value = "sukkur">Sukkur</option>
-
-
</select>
-
<center><br />
-
<strong>To:</strong>**********
-
<select name="to" id="to"></center>
-
-
<option value = "sukkur">Sukkur</option>
-
-
<option value = "karachi">Karachi</option>
-
</select>
Markus 6,050
Recognized Expert Expert
Marcus thanx for the help buddy u helped alot i really appreciate every time i have posted u replied man thanx.
its working now with this direct way.
made another php and database for testing purpose working. -
mysql_query("INSERT INTO test2 (name, dob, gender, country) VALUES ('$_POST[name]', '$_POST[dob]', '$_POST[gender]', '$_POST[country]')");
-
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 ComboBox with out any problems. However, once the application is up and running I cannot add 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 me the sample code for the same?
Thanks for your help.
|
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. In a form in Access 2002, our combobox is
able to load data in a table in separate Access database...
|
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 combobox which is acting weird.
|
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, but I'm running into
problems with my DropDownLists (ComboBoxes).
|
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 where to give that SQL statement in combobox
explanation with program will be verymuch helpfull for...
|
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 usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
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 captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |