SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Thread: Help !!

  1. #1
    SitePoint Zealot ginieg's Avatar
    Join Date
    Feb 2002
    Location
    Houston, TX
    Posts
    103
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Help !!

    How come this code doesn't work ?

    PHP Code:

    <?php 

    include("../common.php");
    include(
    "../db.php");

    dbConnect('gcomme');
     

    if (!isset(
    $submitupdate)): 
     
    ?>

    <html>

     <form method="POST" ACTION="<?=$PHP_SELF?>" >

    <?php

    $sql_exp 
    mysql_query ("select * from experience
    where ID ='
    $ID' ");


    while ( 
    $row mysql_fetch_array($sql_exp) )



    echo(
    '<input type="text" name="location[$i]" value="'.$row["location"].'" >');

    $a=$i;

    $i++;
    }
     
    ?>

    <input type="hidden" value="<? print $a ?>" name="a">
    <input type="submit" value="Update Resume" name="submitupdate">
    </form>
    </html>

    <?php
    else:


    $i 1;
    while ( 
    $i <= $a ) {

    print 
    $location[i] ;

    $i++;
    }
    endif;
    ?>
    I don't see anything after submitting the form...
    Why is that?
    Ginie G.

  2. #2
    Prolific Blogger silver trophy Technosailor's Avatar
    Join Date
    Jun 2001
    Location
    Before These Crowded Streets
    Posts
    9,446
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    well, try using if else with brackets instead of ifelse with colon. Also use single quotes in array values. Incidentally, where do you set $i the first time?

    revised code:
    PHP Code:
    <?php 

    include("../common.php");
    include(
    "../db.php");

    dbConnect('gcomme');
     

    if (!isset(
    $submitupdate)){ 
     
    ?>

    <html>

     <form method="POST" ACTION="<?=$PHP_SELF?>" >

    <?php

    $sql_exp 
    mysql_query ("select * from experience
    where ID ='
    $ID'");


    while ( 
    $row mysql_fetch_array($sql_exp) )
    ?>


    <input type="text" name="<?php echo $location[$i]; ?>" value="<?php echo $row['location']; ?>">
    <?php
    $a
    =$i;

    $i++;
    }
     
    ?>

    <input type="hidden" value="<?php echo $a?>" name="a">
    <input type="submit" value="Update Resume" name="submitupdate">
    </form>
    </html>

    <?php
    } else {
    $i 1;
    while ( 
    $i <= $a ) {

    print 
    $location[i] ;

    $i++;
    }
    }

    ?>
    What does it do for you now?
    Sketch
    Aaron Brazell
    Technosailor



  3. #3
    SitePoint Zealot ginieg's Avatar
    Join Date
    Feb 2002
    Location
    Houston, TX
    Posts
    103
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you for your answer!

    After submitting the form, I still don't see all the location[i] ...

    What could be wrong?
    Ginie G.

  4. #4
    Prolific Blogger silver trophy Technosailor's Avatar
    Join Date
    Jun 2001
    Location
    Before These Crowded Streets
    Posts
    9,446
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Do you have a page that I could see or can you post the output HTML?

    Sketch
    Aaron Brazell
    Technosailor



  5. #5
    SitePoint Zealot ginieg's Avatar
    Join Date
    Feb 2002
    Location
    Houston, TX
    Posts
    103
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Actually, this is the exact code I am working on, as a test.
    Ginie G.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •