Page 4 of 4 FirstFirst ... 234
Results 31 to 37 of 37

Thread: Is it possible to submit a form without reloading the page?

  1. #31
    Join Date
    Sep 2007
    Location
    Maui
    Posts
    642
    Thanks
    284
    Thanked 15 Times in 15 Posts

    Default

    But I couldn't get your way to work. Could you? I would have used it if it had worked, believe me. I'm not into reinventing the wheel. I don't have time. If you can show me code that works that is better than my simple way, I would be happy to use it. I would have been even happier 2 days ago. But it didn't work!

  2. #32
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    I understand. It would require rewriting more than just that section to make it all fit. As I said, there's nothing wrong with the way you did it. It's the everlasting question of doing it the "elegant" way or doing it this simple and "works" way.
    It's all about what saves you the most time-- if you put a lot of work into it right now and do all of that, will it save you time in the end? I don't see any reason why it would. If not, then don't bother. Of course in some cases (like setting up PHP rather than using just HTML files), the extra work clearly is worth it. But here I don't see any reason it would be.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  3. #33
    Join Date
    Sep 2007
    Location
    Maui
    Posts
    642
    Thanks
    284
    Thanked 15 Times in 15 Posts

    Default

    Dear Daniel:

    I am trying to use your ternary operator and am having trouble. I am trying to output a list of client data (name, address, phone, etc) in table format but I am using css so if the value doesn't exist, the data moves into the wrong column. So I am trying to set the value to a hard space if the value doesn't exist. Perhaps there is a better way to do this (?), but this is what I tried...

    Code:
    <?php ($client['phone1'] != '')?$client['phone1']:' ';?>
    and the whole column disappears. Could you please tell me what did I did wrong? Thanks, e

  4. #34
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Looks like you forgot echo. Aside from that it's right.
    Remember-- if the ternary operator is confuses (as it often is), there's no need to use it. If/else works just as well, but it's a little longer to write.

    Code:
    <?php echo ($client['phone1'] != '')?$client['phone1']:' '; ?>

    Also, you might want to use '&nbsp;' instead of ' ' because that will actually hold space in the final design. Either will work for the PHP though.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  5. The Following User Says Thank You to djr33 For This Useful Post:

    kuau (05-04-2010)

  6. #35
    Join Date
    Sep 2007
    Location
    Maui
    Posts
    642
    Thanks
    284
    Thanked 15 Times in 15 Posts

    Default

    Oh, now I understand... thanks! What puzzles me now is that it worked for the first number but as soon as I added the other columns everything disappeared again...

    Code:
    <div class="col-phone"><?php echo ($client['phone1'] != '')?$client['phone1']:'&nbsp;';?></div>
    <div class="col-phone"><?php echo ($client['phone2'] != '')?$client['phone2']:'&nbsp;';?></div>
    <div class="col-phone"><?php echo ($client['phone3'] != '')?$client['phone3']:'&nbsp;';?></div>
    <div class="col-phone"><?php echo ($client['phone4'] != '')?$client['phone4']:'&nbsp;';?></div>
    It doesn't make logical sense to me that the additional lines would make the first line stop working. Thanks so much for your help.
    Last edited by kuau; 05-04-2010 at 01:25 AM. Reason: formatting

  7. #36
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Not sure about that. Perhaps you had a trailing echo from the last section?... not sure if that's likely.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  8. The Following User Says Thank You to djr33 For This Useful Post:

    kuau (05-04-2010)

  9. #37
    Join Date
    Sep 2007
    Location
    Maui
    Posts
    642
    Thanks
    284
    Thanked 15 Times in 15 Posts

    Default

    Sorry, it turns out it does work, but the email address is wrapping to the 2nd line so it looked wrong. I need to work on the formatting more it seems. Sorry to bother you unnecessarily. I REALLY appreciate your help! You are a saint.

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
  •