0

Hi all,

Having a small issue with some PHP i'm re-writing.
I'm converting my old mysql to Mysqli for a new project.

my database is called "jobboard" my table is called "details".

The Idea is to have a drop down and then select the persons name (Which has the ID).
So it would be http://www.domain.com/Update.php?ID=5

or something...

This is the error I am getting:

Notice: Undefined index: ID in C:\wamp\www\JobBoard\Admin\Update.php on line 16
SELECT ID, Employer, LearningProvider, ContractedProvider, LearningDeliverySite, VacancyDescription, VacancyTitle, EmployerDescription, VacancyLocation, WorkingWeek, WeeklyWage, NoVacancies, VacancyRefNumber, ClosingDateForApplications, InterviewBeginForm, PossibleStartDate, TrainingToBeProvided, LearningProviderDescription, ContactDetails, VacancyType, ApprenticeshipFramework, SkillsRequired, PersonalQualities, ImportantOtherInformation FROM details WHERE ID = ''

No database selected

However, I am pretty sure I am selecting a db etc as I am adding and deleting users?

<?php


        // Connect to our DB with mysql_connect(<server>, <username>, <password>)    
        mysqli_connect("localhost", "Jobboard","Password123", "jobboard") or die(mysql_error());
       // mysqli_select_db($con,"jobboard" ) or die(mysql_error());

$error='';
require('config.php');
require('header.php');
echo '<a href="logout.php">Logout</a>';


            $employer_id = $_POST['ID'];

            $query = "SELECT ID,
                     Employer,
                    LearningProvider,
                    ContractedProvider,
                    LearningDeliverySite,
                    VacancyDescription,
                    VacancyTitle,
                    EmployerDescription,
                    VacancyLocation,
                    WorkingWeek,
                    WeeklyWage,
                    NoVacancies,
                    VacancyRefNumber,
                    ClosingDateForApplications,
                    InterviewBeginForm,
                    PossibleStartDate,
                    TrainingToBeProvided,
                    LearningProviderDescription,
                    ContactDetails,
                    VacancyType,
                    ApprenticeshipFramework,
                    SkillsRequired,
                    PersonalQualities,
                    ImportantOtherInformation 
                          FROM details WHERE ID = '{$employer_id}'";

            $result = mysql_query($query) or die('<p>' . $query . '</p><div>' . 
                                   mysql_error() . '</div>');

            $Employer = mysql_fetch_assoc($result);  

?>
 <h2>Updating <?php echo $Employer['Employer'] ?></h2>
                <div class="block ">
                    <table class="form">
                       <form name="Form" action="update_ac.php" method="post">
<!--Intro-->
Employer: <input type="text" name="Employer" value="<?Php echo $Employer['Employer']?>"><br></p>
Learning Provider: <input type="text" name="customer_name_letterhead" value="<?Php echo $Employer['LearningProvider']?>"><br>
Contracted Provider: <input type="text" name="customer_name_letterhead" value="<?Php echo $Employer['ContractedProvider']?>"><br>
Notes go here
</textarea><br>

Thanks

3
Contributors
4
Replies
18
Views
4 Years
Discussion Span
Last Post by diafol
0

Undefined index: ID in C:\wamp\www\JobBoard\Admin\Update.php on line 16

Well, you don't have post data such as a form field sent, e.g.

<input ... name="ID" />

Use an

if(isset($_POST['ID'])){    

Maybe

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.