Jump to content

jpopuk

Members
  • Posts

    64
  • Joined

  • Last visited

Everything posted by jpopuk

  1. That worked great. Thank you very much
  2. Issue solved! Next point is, how do I add additional GROUPS ID: <?php echo $user_data['group_id'] == GROUPS_ADMIN ? I want to add GROUPS_MOD and GROUPS_MEMBER
  3. As I mentioned I tried that but to no effect. Is there a way that the content section can be inserted in another way? <?php echo $user_data['group_id'] == GROUPS_ADMIN ? 'content' : ''; ?> Something like? .... <?php echo $user_data['group_id'] == GROUPS_ADMIN ?) { ?> content <?php : ''; ?> } ?> I have tried this but it did not work. If anyone has a suggestion that would be great. Thanks
  4. I don't think the function is any relevance to the issue I am having. I just need to figure out how I can activate PHP with the ' content ' part of the script. HTML is fine, and as I mentioned you simply add a backwards slash in front of an apostrophe. But when doing this for PHP it just causes an error.
  5. function get_url($page_url, $category_id, $info_id = '', $info_name = '', $default_page = 0) { return $page_url . (array_key_exists($category_id, $GLOBALS['categories']) ? get_url_tidy($GLOBALS['categories'][$category_id]['category_name']) . '-' . $category_id . '/' : '') . ($info_id != '' && $default_page == 0 ? get_url_tidy($info_name) . '-' . $info_id . '.htm' : ''); } Haha, sorry! This is the get_url function:
  6. It looks exacrly like this: <?php echo $user_data['group_id'] == GROUPS_ADMIN ? '<br /> <script type="text/javascript" src="/ckeditor/ckeditor.js"></script> <form method="post" action="<?php echo get_url(\'/products/\', $product[\'category_id\'], $product[\'product_id\'], $product[\'product_name\']); ?>?action=review"> <input type="hidden" name="info_id" value="<?php echo $product[\'product_id\']; ?>" /> <h4>Review Product</h4> <fieldset> <p align="center">Fields marked with a <span class="important">*</span> are required. </p> <p>Please note, you must be registered to post a product review.</p> <table border="0" cellpadding="3" cellspacing="1"> <tr> <td valign="top">Review: <span class="important">*</span></td> <td><textarea name="review" cols="20" rows="5"></textarea> <script type="text/javascript"> CKEDITOR.replace( \'review\', { uiColor: \'#000000\', toolbar: [ [ \'Bold\', \'Italic\', \'Underline\' ], [ \'Cut\', \'Copy\', \'Paste\', \'-\', \'Undo\', \'Redo\' ], [ \'Link\', \'Unlink\' ] ], height: 100, width: 400, }); </script></td> </tr> <tr> <td><a href="javascript:;" onClick="sendGetRequest(\'/includes/get_captcha.php\', \'CaptchaContainer\');">Reload image</a></td> <td><div id="CaptchaContainer" style="height: 32px;"><?php require_once(\'../includes/get_captcha.php\'); ?></div></td> </tr> <tr> <td>Security Code:</td> <td><input type="text" name="code" /> <img src="/images/q-mark.gif" alt="Please enter the values shown above (case insensitive)" title="Please enter the values shown above (case insensitive)" width="15" height="15" /></td> </tr> </table> </fieldset> <p align="center"><input type="submit" name="submit" value="Submit Review" /></p> </form>' : ''; ?>
  7. Thanks for quick response but have tried that. I know that within the content section when using a ' you have to put a backwards slash in front of it to enable the HTML. Not quite sure how to do it with PHP though?
  8. Hi, first of all I am trying to do a section hidden from guests on a website. I have groups for each user (groups_admin, _mod, _member etc.) I have it so ADMIN only view content at the moment, but not sure how to add GROUPS_MOD & GROUPS_MEMBER: <?php echo $user_data['group_id'] == GROUPS_ADMIN ? 'content' : ''; ?> Secondly, where the content section is, I have HTML placed inside it which works fine, but it also has some PHP code. How would I get it so the php code works? This is what I have... <?php echo $user_data['group_id'] == GROUPS_ADMIN ? '<form method="post" action="<?php echo get_url(\'/products/\', $product[\'category_id\'], $product[\'product_id\'], $product[\'product_name\']); ?>?action=review">' : ''; ?> As you can see the form action line has a php url to generate the relevant link for a specific product. If anyone has any suggestions or can help in any way that would be much appreictaed. Cheers, Paul
  9. The options are pulled in from a database so the array part would not be the way to go for me. I have tried this: <option value="<?php echo $post['ad_type']; ?>"<?php echo $post['ad_type'] == $post['ad_type'] ? ' selected="selected"' : ''; ?>><?php echo $post['ad_type']; ?></option> But this did not work.
  10. Hi, I have setup a little post function where you can edit it. When the data has been submitted it sends all data to a database. When I go to edit a post this is how I have each dropdown to load the correct option: <select name="ad_type"> <option selected="selected"><?php echo $post['ad_type']; ?></option> <option>-- Please Select --</option> <option value="For Adoption">For Adoption</option> <option value="For Sale">For Sale</option> </select> How would I do it so it would automatically select the correct option rather than having it add another option at the top? Thanks
  11. Thanks. I have set tables up already so just seeing if possible to do so. I do have a little function to get the data. Is it possible to do a function inside an array? i.e. $acura = array('foreach (get_make_acura() as $macura) { echo $macura['acura_name']; }');
  12. Fastsol, I am having a crack at your tutorial and I have hit a snag. I need to pull data from tables. In the comments part you have put a bit saying to pull the Model FROM cars WHERE model = $model. How would I do it so each selection has gets data from a different table ?
  13. Thank you
  14. I have a small bit of jquery code that is not working: $(function() { $(‘’[name=\'pet_type\']”).change(function() { $(‘’[name=\'breed\']”).removeAttr(‘disabled’); $(‘’[name=\'breed\']”).children(‘data-pet-type[name!=\'’ + $(this).val() + ‘\']’).hide(); $(‘’[name=\'breed\']”).children(‘data-pet-type[name=\'’ + $(this).val() + ‘\']’).show(); }); }); My javascript is not good at all, so cannot spot errors? Any help would be much appreciated! Thanks
  15. Thanks for reply guys. Fastsol - your tutorial looks pretty much what I am looking for. In need of sleep now so will get on the case in the morning. Hoping it will be straight forward to do with the database! Again thanks!
  16. Already have database side sorted. Was just hoping it would be simple like: if option 1 selected then option 1 value echo in second dropdown. Something like that. Cheers
  17. Thank you for reply. Did not realise creating a cascading dropdown could be so complex. - I thought the tricky part would be getting data from database in the form but that was straight forward (as I mentioned above this was already done). Is there not a simplified: if option 1 selected echo option 1 values in second dropdown? Cheers
  18. That is exactly what I am trying to achieve. Looks like AJAX is the way to go. Thanks for reply. - If anyone else has suggestions that would be helpful! Ta
  19. Hi, I want to create a cascading dropdown with each selection pulling data from database (which I have already setup). Here is the form I have to show you what I am trying to achieve: <select name="food"> <option></option> <option value="Fruit">Fruit</option> <option value="Dairy">Dairy</option> <option value="Junk">Junk</option> </select> <select name="select"> <option></option> <option>Fruit</option> <?php foreach (get_fruit() as $fruit) { ?> <option value="<?php echo $fruit['fruit_name']; ?>"><?php echo $fruit['fruit_name']; ?></option> <?php } ?> <option>Dairy</option> <?php foreach (get_dairy() as $dairy) { ?> <option value="<?php echo $dairy['dairy_name']; ?>"><?php echo $dairy['dairy_name']; ?></option> <?php } ?> <option>Junk</option> <?php foreach (get_junk() as $junk) { ?> <option value="<?php echo $junk['junk_name']; ?>"><?php echo $junk['junk_name']; ?></option> <?php } ?> </select> Can anyone point me in the direction of a decent tutorial, or have any tips or advice that would be great! Thanks P
  20. I used your method in the end and works a charm! - Thank you for your help!
  21. So you think it would be better to break it up to dob_day, dob_month, dob_year rather than having have it being pulled from one database entry (dob)?
  22. Yes that is correct. - When I go to edit the post though which is the form in first post, I am not sure why it is not showing correct content. The dob_day field shows the day, but the month and year is not showing correct content even though it has been posted to the database.
  23. Thanks for the reply. - I have had a look at this and unfortunately this will not solve my solution. The data is coming from one from database entry (dob). So essentially the database cell dob will say: 1 January 2014 - rather than 3 individual cells (dob_day, dob_month, dob_year).
  24. Thanks for reply. What you said made good sense with regards to only allowing a certain length as HTML would be invalid. I did a simple solution and put the HTML in a div with overflow set to scroll. - Not the most ideal way but it looks fine! Again thanks.
  25. Hi, I am creating a php script with date of birth fields. I have it so when I add a DOB it does it like this: $dob_day = isset($_POST['dob_day']) && is_numeric($_POST['dob_day']) && $_POST['dob_day'] > 0 && $_POST['dob_day'] <= 31 ? $_POST['dob_day'] : ''; $dob_month = isset($_POST['dob_month']) ? check_input($_POST['dob_month']) : ''; $dob_year = isset($_POST['dob_year']) && is_numeric($_POST['dob_year']) ? $_POST['dob_year'] : ''; $dob = $dob_day . '' . $dob_month . '' . $dob_year; This works absolutely fine. The issue I am having is when I go to edit the DOB in the edit page. It never seems to display all the content correctly. This is how the fields are setup in the edit template: <select name="dob_day"> <option value="">Day</option> <?php for ($i = 1; $i <= 31; $i++) { ?> <option value="<?php echo $i; ?>"<?php echo $dob[0] == $i ? ' selected="selected"' : ''; ?>><?php echo $i; ?></option> <?php } ?> </select> <select name="dob_month"> <option value="">Month</option> <option value=" January "<?php echo $dob[1] == 1 ? ' selected="selected"' : ''; ?>>January</option> <option value=" February "<?php echo $dob[1] == 2 ? ' selected="selected"' : ''; ?>>February</option> <option value=" March "<?php echo $dob[1] == 3 ? ' selected="selected"' : ''; ?>>March</option> <option value=" April "<?php echo $dob[1] == 4 ? ' selected="selected"' : ''; ?>>April</option> <option value=" May "<?php echo $dob[1] == 5 ? ' selected="selected"' : ''; ?>>May</option> <option value=" June "<?php echo $dob[1] == 6 ? ' selected="selected"' : ''; ?>>June</option> <option value=" July "<?php echo $dob[1] == 7 ? ' selected="selected"' : ''; ?>>July</option> <option value=" August "<?php echo $dob[1] == 8 ? ' selected="selected"' : ''; ?>>August</option> <option value=" Septembe r"<?php echo $dob[1] == 9 ? ' selected="selected"' : ''; ?>>September</option> <option value=" October "<?php echo $dob[1] == 10 ? ' selected="selected"' : ''; ?>>October</option> <option value=" November "<?php echo $dob[1] == 11 ? ' selected="selected"' : ''; ?>>November</option> <option value=" December "<?php echo $dob[1] == 12 ? ' selected="selected"' : ''; ?>>December</option> </select> <select name="dob_year"> <option value="">Year</option> <?php for ($i = gmdate('Y', time() + ($user_data['time_offset'] * 3600) + ($config['add_time'] * 3600)); $i >= gmdate('Y', time() + ($user_data['time_offset'] * 3600) + ($config['add_time'] * 3600)) - 25; $i--) { ?> <option value="<?php echo $i; ?>"<?php echo $dob[2] == $i ? ' selected="selected"' : ''; ?>><?php echo $i; ?></option> <?php } ?> </select> This only allows the Day to show fine. - Month and Year just show as Month and Year in their respective dropdowns rather than the actual Month or Year. I know in Month I need to change the numerical 1 through to 12 to the name of the months, but I am unsure on how to do this without messing up the code. As for the year I have no clue to that what so ever. If anyone has any advice or help that would be absolutely brilliant. Thanks in advance, Paul
×
×
  • 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.