Jump to content

bob_the _builder

Members
  • Posts

    206
  • Joined

  • Last visited

Everything posted by bob_the _builder

  1. I thought something like $code = $_GET['code']; unset ($_SESSION['cart']['$code']);
  2. Hey, I have set $_SESSION['cart'] Array ( [sDBVVHR] => 1 [bMNHYR] => 1 ) those are in the cart array.. When I send the variable "BMNHYR" across the url.. and try to unset the matching session variable, I cant seem to get it to work.. How should it be formated? Thanks
  3. Here is what it shoud have been: $total_pages = $total_pages['Num']; correct upper case as cyberRobot said and also quote it as the field is varchar.. Thanks..
  4. mysql_num_rows appear to work.. I never considered using it as I assumed $total_pages = $total_pages[num]; had a purpose and was needed to make the paging work.. Thanks
  5. The following works fine as a query directly in mysql.. SELECT COUNT(pid) as Num FROM products WHERE productgroup = 'Some Group' As a whole $query = "SELECT COUNT(pid) as Num FROM products WHERE productgroup = 'Some Group'"; $total_pages = mysql_fetch_array(mysql_query($query)); $total_pages = $total_pages[num]; It appears that $total_pages is empty, records display but the paging doesnt appear, as it beleaves there are no results.. I guess there is an issue with $total_pages = $total_pages[num]; ? Maybe because the productgroup field is varchar, but I thought that COUNT(pid) would correct it?
  6. I tested the following code: $types_array = array(IMAGETYPE_JPEG, IMAGETYPE_ANOTHERIMAGE); $badImg = array(); foreach ($_FILES['photoname']['tmp_name'] as $key => $iData) { if (!in_array(exif_imagetype($iData), $type_array)) { $badImg[] = $key; } } if (empty($badImg)) { // All files passed. } else { // there was an error and ids are in $badImg } Got the following error, which is the error I got no matter what I tried before posting.. Warning: in_array() [function.in-array]: Wrong datatype for second argument in /home/###/public_html/includes/forms.php(2) : eval()'d code(1) : eval()'d code (1) : eval()'d code on line 35 Thanks
  7. Hey, All file fields must hold files to submit.. I use the following to make sure all 5 file fields are populated.. if (array_sum($_FILES['photoname']['error']) > 0) { $error_msg = 'You must upload 5 logos to continue'; } Thanks[/code]
  8. ops I screwed up the code above and cant edit it.. But you get the idea..
  9. A basic cut down version of what I am trying to acheive.. if(isset($submit)){ if(any_of_the_5_photos_are_not_jpeg) { $error_msg = 'Only jpg files allowed'; } // Insert record } // show form again if error message is not null if (($error_msg == '') && (isset($submit))){ <form action="'.$_SERVER['PHP_SELF'].'" method="post" enctype="multipart/form-data"> $number_of_fields = 5; $counter = 1; while($counter <= $number_of_fields){ echo '<input name="photoname[]" type="file" id="upload" />'; $counter++; } echo '<input type="submit" name="submit" id="submit" value="submit" />'; </form> } Thanks
  10. Yea that side of it is ok... its checking the 5 files that were sent $_FILES['photoname'].. if there are any that arnt jpegs, then populate the error message..
  11. I know there is this method.. if (exif_imagetype('image.gif') != IMAGETYPE_JPEG) { echo 'The photo type is not allowed'; } But I cant get it to run through the array for uploaded files..
  12. I have a form with 5 file fields.. if any of those fields contain a file type thats no allowed, the populate $error_msg, if all the files are correct file types, them leave $error_msg empty.. I have been trying with the likes of below, but it apears to stop all file uploads even when all the files are jpg.. $types_array = array("image/jpeg","image/pjpeg"); if (!in_array($_FILES['photoname']['type'], $types_array)) { $error_msg = 'Invalid File type'; } ? Thanks
  13. By clearing the div.. I mean if i had the form in a different div as you mensioned in an earlyer post?
  14. By switch around do you mean: <script type="text/javascript"> $("#clickme").click(function(){ var data = {email: $('#email').val(), password: $('#password').val()}; $("#content").html('<img src="./loading.gif">'); $.post("jqueryget.php", data, function(response){ $("#content").html(response); },'text'); }); ? Is it possible that upon successful login I could clear the div holding the login form?
  15. The form in this case is for login.. I really need it in the same div.. Basically the page called into the div: jqueryresult.php holds the php code to check against the email and password, relaod the form if match fails or set session data and show member panel.. If I shift the form to another div it will stay visable after successful login..
  16. Hmm strugling to put this together.. It doesnt seem to do it when using get method.. I thought that $("#content").html('Retrieving...'); is just a loading screen while it processes the request.. assuming that it would still grab the posted variables and reload the div with the new data.. How should it be so I can have the entire script within the #content div without having to place the form outside the div? Thanks
  17. So i think the anwer to the above question is the .live() function.. this seems to work great for GET data, but using POST no data seems to arrive after being submited.. Here is what I have now: <!-- Div to load content in --> <div id="content"> </div> <!-- To populate the #content div when page first loads --> <script type="text/javascript"> $('#content').load('jqueryresult.php'); </script> <!-- The query to process and pass on the form data --> <script type="text/javascript"> $("#clickme").live('click',function(){ $("#content").html('Retrieving...'); var data = {data1: $('#data1').val(),data2: $('#data2').val(),data3: $('#data3').val()}; $.post("jqueryresult.php", data, function(response){ $("#content").html(response); },'text'); }); </script> jqueryresult.php layout: <input id="data1" type="text" value="" /> <input id="data2" type="text" value="" /> <input type="button" id="clickme" value="Submit" /> <hr /> <?php echo ''.$_POST['data1'].' -- '.$_POST['data2'].''; ?> What am I missing for the variables not to be captured? If I place the button and fields outside the #content div it works fine.. Maybe <script type="text/javascript"> $('#content').load('jqueryresult.php'); </script> Maybe the above cancelling it out again?
  18. It would appear you cant u run a jquery function from within the div you are loading it into? Example This works.. <input id="email" type="text" value="" /> <input id="password" type="text" value="" /> <input type="button" id="clickme" value="submit" /> <div id="content"></div> <script type="text/javascript"> $("#clickme").click(function(){ $("#content").html('<img src="./loading.gif">'); var data = {email: $('#email').val(), password: $('#password').val()}; $.post("jqueryget.php", data, function(response){ $("#content").html(response); },'text'); }); </script> This doesnt work.. <div id="content"> <input id="email" type="text" value="" /> <input id="password" type="text" value="" /> <input type="button" id="clickme" value="submit" /> </div> <script type="text/javascript"> $("#clickme").click(function(){ $("#content").html('<img src="./loading.gif">'); var data = {email: $('#email').val(), password: $('#password').val()}; $.post("jqueryget.php", data, function(response){ $("#content").html(response); },'text'); }); </script> I am wanting the login process complete within the div tag id #content, not by placing the form outside of it?
  19. Ahh yes.. thats did the trick.. hard to explain some times Thanks..
  20. I dont know how to explain it any better.. Another attempt: $("#clickme").click(function(){ $("#content").html('Retrieving...'); var url = $(this).attr('href'); $.get(url, function(response){ $("#content").html(response); },'text'); }); Link I beleave should work to access above function?: <a href="jqueryget.php?pid=$pid" id="clickme" onclick="#content">Show Details</a> Problem: The entire page reloads, instead of just the div area.. <div id="content"> </div> Thanks
  21. I know this works.. $(document).ready(function () { $('#code').load('jqueryresponce.php?data1=Some&data2=Data'); } ); But I want to click a link holding the variables and parse them to the div that way.. Im totally new to Jquery.
  22. Never really used FireBug.. Have installed it.. not seeing any issue, where should I be looking to find them within firebug? Thanks
  23. Yea and from my understading the code below should work.. <script type="text/javascript"> $(document).ready(function(){ $("#clickme").click(function () { $("#content").html('Retrieving...'); $.ajax({ type:"GET", data:{ "data1":"12345","data2":"test" }, url: "jqueryresponce.php", success: function(msg){ $("#content").html(msg) } }); }); }); </script> <div id="content"> </div> In the page jqueryresponce.php, I have echoed out the get variables but noting loads in the div..
  24. Not sure how to explain it.. But lets say via ajax I would send a request to be loaded in the div using: <a href="javascript: testAjax('myDIV')">Show Name</a> Not sure how to acheive the same thing using the jquery function above.. Thanks
  25. I guess i mean, send the variable(s) via a link so i can query the database based on the variable(s) received within the div.. Opposed to doing it via a form and posting the variables..
×
×
  • 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.