Jump to content

boushley

Members
  • Posts

    41
  • Joined

  • Last visited

    Never

Everything posted by boushley

  1. Well, the imagecolorallocate function doesn't want a string thtas the path to the image... but it wants a resource handler. On php.net under imagecolorallocate it says... So fixing that... will help a lot.
  2. yes, make your form.html a form.php. And have the form submit to itself. Then you wrap your PHP in an if(isset($_POST[...])) You have quite a few naming capitalization problems. Where you didn't follow your convention. Such as with the postal code on the errors.php code.
  3. Well, are there any pages that forward someone to this page? AKA On each page when you check if they are logged in... do you send them back here? Obviously there is something funky happening if you are hitting both the if and the else. My guess is that you are correct, that it is processing the information twice. So try taking out your redirect first... just to confirm this is the case... Then start looking elsewhere... when they redirect, why would they be sent back to this page?
  4. Its really not very hard to write one... 1=25 & 10000=300... so you've got a difference of 9,999 and 275. So, it would be something like price=25+(num*(275/9999)) And then can you do it from there?
  5. boushley

    Puzzled

    So you would be able to use something like... //however you want to check if they're logged in... //this is if they're not header('Location: log.php?dest='.urlencode($_SERVER['REQUEST_URI'])); Then on the log.php you could set a hidden form field to pass this along... and then upon a successful login, if this value exists... you can forward them there.
  6. LOL... you should have just reposted... you completley changed your question... Do you want to search for a value... or an id? I'll assume you are wanting to pass an id and if it is there then delete it, if not create it. <?php $id = $_GET['id']; if(isset($myArray[$id])){ unset($myArray[$id]); } else { $myArray[$id] = something; } ?>
  7. Are you sure the cookie wasn't already set? Because... it really has no way to get into the if & the else. What does the security that you're putting onto each page look like? Try putting some echo statments in there... and see if it is really getting into both sides of the if (it really shouldn't be).
  8. Did you say that it was setting the cookie as well? All the fields seem to match up... other than the hiddenfield... you have hiddenfield2 in the form and just hiddenfield in the php page... but that should not be causing the error you're reporting!
  9. Well... you could pass something in the url such as example.php?action=add&id=1 or example.php?action=del&id=1... or you could just pass an id and if it exists delete it and if it doesn't add it. Depends on what its for and what you want it to do... but the code would look something like this... <?php $id = $_GET['id']; $action = $_GET['action']; switch($action){ case 'add': $myArray[$id] = something; break; case 'del': unset($myArray[$id]); break; } ?>
  10. As well, for printing... you could do this <?php echo implode('', $myArray); ?> Not sure on the efficiency of one or the other.
  11. print_r($myArray);
  12. Thanks for the advice obsidian. I had seen forms that were self submitting... and wondered what the benefits were. Thanks. And the dynamically generated select, thats a lot easier than the dirty way I was doing it. Thanks.
  13. Well... on the page you could do something like $myArray[$id] = null;
  14. Sorry about posting to the wrong forum... wasn't sure seeing as how it was a mixed topic. If a MOD could move it... that would be great. And I know how to use PHP Sessions... but I was just asking for advice on the style of putting the values back into the fields. I know you could use get, or you could register it to their session and then plug it back into the form. And I can accomplish the task at hand... I'm just wondering if there is a cleaner way of doing it.
  15. Like pocobueno1388 said, its hard to help much unless we can see more of the code... because <div class="cont_txt"> line 1 line 2 line 3 </div> and <div class="cont_txt">line 1</div> <div class="cont_txt">line 2</div> <div class="cont_txt">line 3</div> work fine in both of the mentioned browsers... so we need to see the php code, to help you out. Or maybe even the output page...
  16. I'm wondering what tips you have for making forms in php. I'm specifically wondering what tips everyone has about style I guess. My biggest question is about filling data in when someone returns to a page (ie they didn't fill out all the data and are sent back to the page) Generally I send the data back as post data. And when I put it back into the form things can start to look pretty hairy. such as... <input type="text" name="example" value="<?php if(isset($_GET['example'])){ echo $_GET['example']; } ?>"> another fun one is selecting the correct option in a dropdown... I can do it <select name="example"> <option value="1" <?php if($_GET['example']=='1'){ echo 'selected="selected"'; } ?>>1</option> <option value="2" <?php if($_GET['example']=='1'){ echo 'selected="selected"'; } ?>>2</option> </select> but that turns out pretty ugly. So lets see what style tips or suggestions you've got. Thanks for the help! I don't know where to find something like this. [and if you point me in the direction of some good "best practices" or style guides... that would be appreciated as well]
×
×
  • 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.