Notice: Undefined index: make

Hi, complete newbie here. I keep getting “undefined index” error and I can’t figure out what I’m doing wrong. I’ve been racking my brain for hours and I don’t understand why I’m getting this error. Any help is appreciated.

I’m getting the error on lines 14 and 22 (see asterisks). Thank you!

[php]<?php
$a = session_id();
if(empty($a)) session_start();

$_SESSION['AdvancedSearchWhereClause']="";

// Get the Dropdown Data
if(empty($_REQUEST[‘make’])) {
$_SESSION[‘MakeID’] = 0;
} else {
$_SESSION[‘MakeID’] = $_REQUEST[‘make’];
}
echo $_REQUEST[‘make’]; // Debug ** GETTING ERROR HERE **
echo $_SESSION[‘MakeID’]; // Debug

if(empty($_REQUEST['model'])) {
	$_SESSION['ModelID'] = 0;
} else {
	$_SESSION['ModelID'] = $_REQUEST['model'];
}
echo $_REQUEST['model'];						// Debug      ** GETTING ERROR HERE **
echo $_SESSION['ModelID'];						// Debug

include "MySQLConnector.txt";

?>

  <tr><td>Model: </td>
      <td><SELECT NAME="model" Size="1" OnChange="this.form.submit()" style="width:185;font:8pt 'Arial'">
	  <OPTION VALUE="0">Step 2) Select your Model . . .</option>
<?php $query = "SELECT * FROM zlu_model"; // Build the query $query = $query . " WHERE Active=1"; $query = $query . " AND MakeID = " . $_SESSION['MakeID'] ; $query = $query . " ORDER BY Description"; $r = @mysqli_query ($dbc, $query); // Run the query while ($row = mysqli_fetch_array($r, MYSQLI_ASSOC)) { // Fetch the data $DbModelID = $row['ModelID']; $Description = $row['Description']; if ($DbModelID == $_SESSION['ModelID']) { $ModelIsSelected = "SELECTED"; } else { $ModelIsSelected = ""; } ?>
		   <OPTION VALUE="<?=$DbModelID;?>" <?=$ModelIsSelected;?>><?=$Description;?></option>
<?php } ?>
	  </SELECT></td></tr>

  <tr><td>Condition:</td>
  	<td><input type="radio" name="rdocondition" value="1" /> New&nbsp;&nbsp;&nbsp;
	<input type="radio" name="rdocondition" value="2" /> Used&nbsp;&nbsp;&nbsp;
	<input type="radio" name="rdocondition" value="3" /> Certified Used</td></tr>

  <tr></tr>
  <tr></tr>
  <tr></tr>
    <td valign="top" nowrap>Safety Options:&nbsp;</font></td>
    <td valign="top">
      <div id="chklist">
	<table>
	  <tr><td><font color=black>Select all safety options that apply:</font></td></tr>
	  <tr><td><b><hr size=0 color=silver noshade></b></td></tr>
	  <tr><td><input value="1" type="checkbox" name="chkCon1" />&nbsp;Front Air Bags</font></td></tr>
	  <tr><td><input value="2" type="checkbox" name="chkCon2" />&nbsp;Side Air Bags</font></td></tr>
	  <tr><td><input value="3" type="checkbox" name="chkCon3" />&nbsp;Antilock Brake System</font></td></tr>
	  <tr><td><input value="4" type="checkbox" name="chkCon4" />&nbsp;Bluetooth hands-free calling</font></td></tr>
	  <tr><td><input value="5" type="checkbox" name="chkCon5" />&nbsp;Adaptive cruise control</font></td></tr>
	  <tr><td><input value="6" type="checkbox" name="chkCon6" />&nbsp;Blind-spot monitoring</font></td></tr>
	  <tr><td><input value="7" type="checkbox" name="chkCon7" />&nbsp;Rearview cameras</font></td></tr>
	  <tr><td><input value="8" type="checkbox" name="chkCon8" />&nbsp;Traction control</font></td></tr>
	</table>
      </div>
    </td>
  </tr>
  <tr><center><td colspan=2 align=center><input type='submit' name='action' value='Search' /></td></center></tr>
</table>
   </form>
<?php mysqli_close($dbc); ?>

[/php]

Make: Step 1) Select your Make . . . <?php $query="SELECT * FROM zlu_make WHERE Active=1 ORDER BY Description"; // Build the query $r = @mysqli_query ($dbc, $query); // Run the query while ($row = mysqli_fetch_array($r, MYSQLI_ASSOC)) { // Fetch the data $DbMakeID = $row['MakeID']; $Description = $row['Description']; if ($DbMakeID == $_SESSION['MakeID']) { $MakeIsSelected = "SELECTED"; } else { $MakeIsSelected = ""; } ?> ><?=$Description;?> <?php } ?>

it simply means that the make and model are declared in any part of the script.

it looks like you sending data to this form from another script via post or GET if so check to make sure that all data are being passing thru because make and model are not getting any there

however i see you are fetching from database if you want to echo the values you cant do this with REQUEST

instead it should be like this
eg:
[php]
echo $row[‘MakeID’];
[/php]

Thank you. Yes, I am getting data from the database. Everything else is coming back fine. I’m not sure what you mean by sending the data to this form from another script (again I’m new at this) or where that might be located. There are supporting php documents. But the weird thing is that I am using code given to me from a sample and that worked perfectly fine.

[php]
echo $_REQUEST[‘make’]; // Debug ** GETTING ERROR HERE **
[/php]
the abode code should not work unless you getting data from a form or URL

if you want print make from the database it should be
[php]
echo $row[‘Make’];
[/php]

The data is entered into a form and then sent to the database. Then it is pulled back out of the database and put back into a form. And there is also search capability to search based on filters.

do you have skype?

Sorry just saw your message. Yes, I have Skype.

i sent you a personal message

Sponsor our Newsletter | Privacy Policy | Terms of Service