Jump to content

edit profile php


ianhaney50

Recommended Posts

Hi

 
I have now made the project site I am working on much simpler than before and now got all the fields in one form and added to one dbtable
 
I have got the profile.php page working so it displays all the data from the users table and renewal table for the dates to display to display
 
Now I am trying to make a edit-profile.php page which I have made and put all the coding and put the markup at the bottom and the php above it but for some reason the current data is not displaying within the form fields
 
I have done a var_dump on the query and outputs the following
 
string(346) "SELECT u.id , name , email , address1 , address2 , town , county , postcode , telnumber , mobnumber , model , numplate , DATE_FORMAT(renewal_date, '%e %M %Y') as datedue FROM users u INNER JOIN renewal USING (id) INNER JOIN item USING (item_id) WHERE id='23'"
 
so then did a var_dump on just on the one variable var_dump($name); and that outputted the following
 
string(9) "Ian Haney"
 
so seems to connecting to the db and retrieving the data so not sure why is not displaying the current data within the form, all the fields are the same as the db etc.
 
the link to the pastebin coding is below
 
Link to comment
Share on other sites

your form code is not using the variables that you assigned values to in the loop. in fact, why are you looping to retrieve one row.

 

if you eliminate the loop, just fetch the row from the database, and forget about all the assignment statements, your code will work, because the form code is using the $row[...] variables that the fetch statement would populate.

 

if you are not getting any php errors, i seem to recall that php changed at some point so that accessing an associative array index on a null/false value doesn't throw undefined index error messages.

Link to comment
Share on other sites

I now changed it to the following

<label>Car Tax Renewal Date :</label>
<input type="text" id="datepicker" name="tax" required="required" placeholder="Please Enter your Car Tax Renewal Date" value="<?php echo $row['tax'];?>" />
<br /><br />
<label>MOT Renewal Date :</label>
<input type="text" id="datepicker2" name="mot" required="required" placeholder="Please Enter your Car MOT Renewal Date" value="<?php echo $row['mot'];?>" />
<br /><br />
<label>Insurance Renewal Date :</label>
<input type="text" id="datepicker3" name="insurance" required="required" placeholder="Please Enter your Car Insurance Renewal Date" value="<?php echo $row['insurance'];?>" />

that gives me the following error

Notice: Undefined index: tax in /home/sites/broadwaymediadesigns.co.uk/public_html/sites/the-tax-elephants/edit-profile.php on line 128

I got the following in, if I change datedue on them lines to the individual ones so insurance, tax, mot, I get more errors
 

$insurance = $row['datedue'];
        $tax = $row['datedue'];
        $mot = $row['datedue'];

so it becomes

$insurance = $row['insurance'];
        $tax = $row['tax'];
        $mot = $row['mot'];

the errors I get then are below

Notice: Undefined index: insurance in /home/sites/broadwaymediadesigns.co.uk/public_html/sites/the-tax-elephants/edit-profile.php on line 85 Notice: Undefined index: tax in /home/sites/broadwaymediadesigns.co.uk/public_html/sites/the-tax-elephants/edit-profile.php on line 86 Notice: Undefined index: mot in /home/sites/broadwaymediadesigns.co.uk/public_html/sites/the-tax-elephants/edit-profile.php on line 87

Edited by ianhaney50
Link to comment
Share on other sites

and as someone already mentioned, your code isn't using, nor does it need, the $variable = $row[index_name]; ...assignment statements. the time you spent putting those in, and now in changing them, isn't accomplishing anything, because your code isn't using those assigned variables and the only way you wouldn't know this is if you aren't looking at what you are doing.

 

at this point, i don't think you are even looking at your code, just throwing random things against the wall to see if any of it sticks, and then dumping it on help forum(s) to get someone to put the code together the correct way for you. that's not you doing or learning programming. that's randomly trying things and almost never results in code that works.

  • Like 1
Link to comment
Share on other sites

at this point, i don't think you are even looking at your code, just throwing random things against the wall to see if any of it sticks, and then dumping it on help forum(s) to get someone to put the code together the correct way for you. that's not you doing or learning programming. that's randomly trying things and almost never results in code that works.

I have to agree. It seems like you're in a bit over your head. You need to actually understand the things you are typing into your editor, and not just copy/pasting things that people told you should work.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.