Note that there are some explanatory texts on larger screens.

plurals
  1. PONotice - Undefined Variable in PHP
    primarykey
    data
    text
    <blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="https://stackoverflow.com/questions/4261133/php-notice-undefined-variable-and-notice-undefined-index">PHP: “Notice: Undefined variable” and “Notice: Undefined index”</a><br> <a href="https://stackoverflow.com/questions/6942000/php-undefined-variable">PHP - Undefined variable</a> </p> </blockquote> <p>I am doing PHP for the first time, quite enjoying it however stuck on one error which is</p> <blockquote> <p>Notice: Undefined variable: customerid in C:\xampp\htdocs\cravendale\showconfirm.php on line 32</p> <p>Notice: Undefined variable: holidayid in C:\xampp\htdocs\cravendale\showconfirm.php on line 43</p> </blockquote> <p>code for <code>showconfirm.php</code></p> <pre><code>&lt;?php //Capture the customerid from the URL and send to a local variable $booking = $_GET['customerid']; //echo out some blurb echo "&lt;h2&gt;Thank you for your booking&lt;/h2&gt; You may wish to print this page for future reference &lt;br /&gt; &lt;br /&gt; &lt;h2&gt;Your details&lt;/h2&gt;"; //Open up our dataconnection include 'config.php'; include 'opendb.php'; //Get the booking details from the database $getbooking = mysql_query("SELECT * FROM tblbookings WHERE tblbookings.bookingid = @$booking"); while($booking = mysql_fetch_array($getbooking)) { @$customerid = $booking['customerid']; $holidayid = $booking['holidayid']; } //Get the customer details $getcustomer = mysql_query("SELECT * FROM tblcustomers WHERE tblcustomers.customerid = $customerid"); while($customer = mysql_fetch_array($getcustomer)) { echo "&lt;p&gt;&lt;b&gt;First Name:&lt;/b&gt; " . $customer['customerfirstname'] . "&lt;br /&gt;&lt;br /&gt; &lt;b&gt;Last Name:&lt;/b&gt; " . $customer['customerlastname']. "&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;h2&gt;Your Holiday&lt;/h2&gt;"; } $getholiday = mysql_query("SELECT * FROM tblholidays WHERE tblholidays.holidayid= $holidayid"); while($myholidays = mysql_fetch_array($getholiday)) { //We get the destination name $chosendestination = $myholidays['destinationid']; $getchosendestination = mysql_query("SELECT tbldestinations.destinationname FROM tbldestinations WHERE tbldestinations.destinationid = $chosendestination" ); while($mydestination = mysql_fetch_array($getchosendestination)) { echo "&lt;b&gt;Destination: &lt;/b&gt;" . $mydestination['destinationname']; } //We get the name of the hotel $chosenhotel = $myholidays['hotelid']; $getchosenhotel = mysql_query("SELECT tblhotels.hotelname FROM tblhotels WHERE tblhotels.hotelid = $chosenhotel" ); while($myhotel = mysql_fetch_array($getchosenhotel)) { echo "&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Hotel: &lt;/b&gt;" . $myhotel['hotelname']; } //We get the price $chosenprice = $myholidays['pricebandid']; $getchosenprice = mysql_query("SELECT tblpricebands.pricebandcost FROM tblpricebands WHERE tblpricebands.pricebandid = $chosenprice" ); while($myprice = mysql_fetch_array($getchosenprice)) { echo "&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Price: &lt;/b&gt;&amp;pound;" . $myprice['pricebandcost']; } $phpdate3 = strtotime( $myholidays['holidaystartdate'] ); $mysqldate3 = date( 'd-m-Y', $phpdate3 ); echo " &lt;br /&gt;&lt;br /&gt;&lt;b&gt;Start date: &lt;/b&gt;" . $mysqldate3 ; } ?&gt; </code></pre> <p>i have researched about this error a lot, the closest clue i am getting is to put "@" before $customerid and <code>$holidayid</code>. The errors dissappear but the information from the form isn't loaded.</p> <p>Any help would be greatly appreciated. </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload