Jump to content

spiderwell

Members
  • Posts

    1,008
  • Joined

  • Last visited

Posts posted by spiderwell

  1. upload the files to the thread, i will take a look, but its gone midnight here, i might well have to do it in the morning.

     

    i am happy to upload it and play around with it on your server, but message that information to me if you really want me to.

     

     

  2. set an extra column in the db called approved, and have it default to 0 in db structure, then as later admin you can set to 1 to approve it.

     

    when user submits, use the same code, as approved wont need entering to the row, its will set to 0 by default.

     

    then via phpmyadmin, or build a page for an admin to login to set approved to 1

     

     

    **disclaimer** this is how i would do it, there might be a better way  :P

  3. try $_GET['id'] not $_GET[id] ?

     

    not good practice to put raw data into an sql statement, pass the value to a local variable first and validate its what you expect it to be.

     

    echoing out the sql statement will show you what is being passed to the database, handy when things arent working

  4. change the action of the form to the name of the php file you are posting to, i.e. sendinfo.php, if you dont give action a value it will post to itself

     

    the radio buttons are nearly there, you dont really need the id in this instance, change the values to be the same as the label text:

    <label>
    <input type="radio" name="stockinfo" value="aviation" id="stockinfo_0">
        Aviation and Aerospace</label>
    

     

    as you have it they all contain the value of 'radio'

     

    in the php page have this:

     

    echo $_POST['stockinfo'];
    

     

    when you POST a form all the input elements are put into the $_POST[] array, then use the name of the element you want to retrieve the value from into that array

    so for the radio button elements you have i use $_POST['stockinfo']

    if you had a text input in the form aswell with asking for the user to enter there name that looks like this:

    <label><input type="text" name="myname">
        Enter name</label>
    

    you would get the value by

     

    echo $_POST['myname'];
    

     

    dont worry the php will get easier, especially if you hand code it, dreamweaver is great but it doesnt actually teach you php, its more a designers tool than a developers (in my opinion), notepad++ is what I use personally.

  5. oh boy, erm how much php have you done?  :P

     

    read this

     

    id is like a name but unique, rather than name can be multiple (radio buttons have the same name) of the form element, value is whats stored in that form element

     

    <input name="username"  value="stepo">  this will give text input with a prefilled value of stepo

     

    retrieve it from form by trying echo $_POST['username']

     

     

  6. hot_job and nurse_vet are column names, never put quotes around them as quotes represent values, use backticks or omit altogether

     

    `hot_job`='blah', nurse_vet = 'stripper'

     

    I'm going for a smoke, you better have it working by the time i get back :P

  7. create the new page called info.html

     

    make a select dropdown box or a radio button (checkboxes allow multiple sections and it states one select 1 type)

     

    add options like banks,oil,gold,frozen oj,pork bellies, etc

     

    the sendinfo.php will then get the value selected lets say it was oil, and returns information about oil stocks.

    in this case the assignment states open a text file thats relevant, so i would suggest you make a correlation of:  filenames = values from the form.

     

    user selects oil, open file oil.txt and read contents into webpage.

    user selects banks, it opens banks.txt

     

    read a text file link

     

     

  8. 5 key stages in the assignment, and no indication to which part you are struggling with, I expect I speak for many members when I say 'jog on'

     

    this is a help forum, not a 'hand your assignment over to a stranger to do' forum.

     

    You post indicates no thought processes towards your assigned work, none of us are mind readers, give us something, we are likely to give something back.

     

     

     

     

  9. you are still muddling editid and id variables, and now you are asking for an editid via $_GET inside a $_POST so it wont work

    change this bit

    if ($_POST) {
    $editid = $_GET['editid'];
    

     

    to

    if ($_POST) {
    $editid = $_POST['id'];
    

     

    showing exactly why you should stick to 1 variable through a process, in your script you have $delid,$editid $id and they all carry the same value (ID from the database table)

    I cannot urge you enough to stop doing this

    you are using action to decide what $action to take, not $id, its so not needed and only proving to make things more complicated for you unnesscessarily

     

    TIP:

    a very good way to check the sql is to echo out the sql statement into the page whilst you develop

     

    $query2 = "UPDATE jobs SET job_title='$job_title',job_description='$job_description',job_type='$job_type',job_area='$job_area','hot_job'='$hot_job','nurse_vet'='$nurse_vet' WHERE id=$editid"; 
    echo $query2;
    

     

     

  10. sunfighter, your idea would be fine if it was all <li> to have red font, but I only want 1 of them too. I guess I hadn't made it clear enough.

    I am sorry i got that wrong, it worked perfectly.

     

    I thought I could just have one class to cover all red text in various different lists, but i guess i need the red class defined inside each id specified too. good to learn though, i am so guilty of not learning css properly as this thread proved

  11. thats because when you post its still executing the prepopulation part too.

     

     

    also you are using 2 variables for the same value $editid and $id are the same thing, chose one and stick to that throughout

     

    if(action=="edit")
    {
    if ($_POST)
       {
         //do the updating stuff
       }
       else 
       {
          //show prepopulated form
        }
    }
    
    

  12. ah nice link there, basically the id has a higher specificity so it over rules the applied class.

     

     

    sunfighter, your idea would be fine if it was all <li> to have red font, but I only want 1 of them too. I guess I hadn't made it clear enough.

     

  13. so having divs that toggle from hidden and visible could affect your SE rankings?

     

    only i have made many pages in the past where i have a list of items than when clicked 'show' the div containing the relevant info, and hide all the others (all divs positioned in same place)

     

  14. i have a UL within a DIV that has an ID, i then use that to set up styling for the list and its elements.

    .red {color:#ff0000;	font-weight:bold;} 
    
    #sectionlist { list-style: none; width:800px;margin-left:0; }  
    #sectionlist ul{ list-style: none; margin:0px; padding:0px;} 
    #sectionlist li { position: relative; margin: 2 0 0 0;  width: 800px;-moz-border-radius: 5px; -webkit-border-radius: 5px; font-size:14px; border:#000000;text-decoration: none;
    padding:  1px;
    margin-right: 3px;
    border: 1px solid #778;
    color: #2d2b2b;
    background-color: #ddddff;
    height:22px;
    margin-top:2px;
    text-align:left;
    font-size:12px;
    }
    

     

     

    now i want to make one of the <li> elements have red text, i add a class called red so it looks like this <li class="red">

     

    but it never shows up red, i have to end up adding a span or div inside the <li> to get the class of red to work.

     

    is this normal behaviour or am I missing something?

  15. try echoing put the $row[] data before you pass to variables, just to be sure that it is pulling out the data from the database?

     

    also your hidden field is borked, its got a name that probably (im not 100'%) got illegal characters, and no value.

     

    does teh form  itself display? if it does it means something is found in the database as its echoed inside the while loop

×
×
  • 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.