Jump to content

xpace

Members
  • Posts

    30
  • Joined

  • Last visited

    Never

Contact Methods

  • Website URL
    http://www.xpace.sk

Profile Information

  • Gender
    Not Telling

xpace's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. thanks mate for the suggestion. as I have no idea how this works I would really need someone to show me the script as the script I have is also from some ajax guru thanks a lot
  2. I have an onchange function in my PHP form that sends a value via GET and then shows it in a DIV named extra. form method is POST btw <select name='business_type_main' onchange=\"$('#extra').load('?trade='+this.value);\"> it shows up checkboxes selected by the value of /trade/ without reloading the page. then I just select any number of checkboxes and press NEXT, which is a SUBMIT button (of course there are other fields to fill up). after pressing the SUBMIT (NEXT) button it will call a PHP function to check all required fields and if there are some missing or incorrect, it will show up the same form with already inserted values and warning messages. here comes the big problem : I need to show the checkboxes again with the originally ticked boxes and have the /trade/ variable value ready again for following SUBMITs so everytime the client makes a mistake it will show all the fields with values already inserted including the checkboxes. I hope it is clear enough to understand my problem. thanks very much
  3. hey, I know I do, because I can see it on a page but I don't know which area to take out or move somewhere else- that's the part where I said that I have no idea where the problem is if you could just point me there that would really help thanks
  4. Hi all, I have this code, created myself <?php $xbox = array(1,2,3,4,5); //this will be take from database - this is just for testing reset($xbox); if($_POST){ foreach($_POST['box'] as $key=>$value){ $_SESSION['storedbox'][$key] = $value; } foreach($_SESSION['storedbox'] as $key=>$value){ echo 'The value of $_SESSION['."'".$key."'".'] is '."'".$value."'".' <br />'; //just for testing } } echo "<form action='' method='POST'>"; if(isset($_SESSION['storedbox'])){ foreach($xbox as $x){ for($i=0;$i<count($_SESSION['storedbox']);$i++){ if($_SESSION['storedbox'][$i] == $x){ $x_sel = "CHECKED"; }else{ $x_sel = NULL; } echo "box_".$x." <input type='checkbox' name='box[]' value='".$x."' ".$x_sel."><br />"; } } }else{ foreach($xbox as $x){ echo "box_".$x." <input type='checkbox' name='box[]' value='".$x."' ".$x_sel."><br />"; } } echo "<input type = 'submit' name='go' value=' go '></form>"; ?> and the purpose is that when you select something and hit GO button it should reappeared exactly how you selected it in the first place. it's ok when you select only one checkbox but when you do multiple it will multiply the checkboxes as well. you can try for yourself. I have no idea where the problem is though I know there is something I don't like in the code but not sure where thanks a lot
  5. hey, this is what I was trying to do but I can't move any forward. function make_checkboxes ( $select_value, $checked_values = array() ) { $sql_x = mysql_query(" SELECT * FROM ".$tbl_prefix."category_sub WHERE sub_main_category_id='".$select_value."' ORDER BY sub_cat_name ASC ") or die ("no no no".mysql_error()); while ($row_x = mysql_fetch_array($sql_x)) { if ($_POST['sub_select'] && $_POST['sub_select'] == $row_x['sub_cat_id']) { $check_selected = "CHECKED"; } echo "<input type='checkbox' name='sub_select[]' value='".$row_x['sub_cat_id']."' ".$check_selected."> ".$row_x['sub_cat_name']." - ".$row_x['sub_cat_id']."<br />"; $check_selected = NULL; } } This part I've tried to list the sub category with checkboxes first and it works but it's not showing again after submitting(the whole div), but then I wanted to use your function and have no idea how to make the checkboxes again selected after submitting(I mean only those that been really selected) in that function if(isset($_GET['trade'])){ //Everything in here will get echoed in the DIV echo make_checkboxes($_GET['trade']); exit; } this is the second bit you suggested and I'm hoping I got it right but thats it. with last bit you sent I'm not sure where to put it as in the DIV it would be sort of strange when the second bit is already showing what's in it. I'm really not good at this, I probably burn my PC down and will go to make some boomerangs thanks
  6. You lost me on this one I think I understand this bit and this one I think I know what you mean can you get a real example, so I can see what's happening there ? thanks
  7. these will be checkboxes so those that are selected will need to stay selected until you press register man thanks a lot for now I have to go to bed as it's 1:30 am, need to wake up about 6 so time to go. if you come up with something, please let me know again thanks
  8. the first option. let's say you have fields to fill in: name surname address x x x and here you have drop down list of items (you pick - airconditioning) after your pick it will run your ajax script and show this below: comercial residential services sale and then you have please provide details "textbox" and so on and on and on when you press NEXT, which is a submit button, it will check if you have filled in all the details in correct format and if you are not trying to hack the site. when the script finds the problem or missing field it will come back (reloads the form with correct details you have provided previously, including those values called via ajax script, asking you to finish it) then you press next again and if everything is clear it will come up with the same form with all the details plus CAPTCHA box and instead of NEXT button you have REGISTER button. so that's why I have to keep thatvalue somewhere
  9. Hey, OK I got it working with partial code of yours. but there is another thing. I need to keep those values or that value from selection to future submits of the form. any way of doing that. I think I would find the way, but I obviously you'll have the answer in few seconds I can post you the code, but it's confidential even though it's not from professional :-\ and it's still a work version
  10. Hang on, I'm getting something not perfect something but something. give me a sec
  11. hey, that was a quick one thanks but it doesn't work how about submitting form with passing just that value. I'm just confused, because the script is quite complicated to put the ajax in. I would have to rewrite it all over again, and that's a big NO it's a 500 lines of code that just works like a charm, of course without this selection I want. :'(
  12. Here is another idea: when item is selected, form will be submitted onchange and value from the selection + my variable that I will call "$nocheck" with value = 1 will be passed is that possible ? because when I submit my form now I have an error checking procedure, and if it finds errors it will call this form again. so avoiding the error check will give a client peace in filling the other fields of teh form. thanks
  13. Hey, I'm sure I'm not being perfectly clear about this code. I know what PHP does and I know what JS does at least 90% I just need that value from the selection and put it into a variable $anything(PHP variable) so after I get it I will call a PHP function to process this variable. I'm not sure yet if it is possible this way but I don't see why not Maybe I wasn't very clear about this JS you trying to get for me. It should also submit the form as I mentioned in the first post. but then I was thinking to open the DIV to see it. maybe that has given you and now me bit of confusion. I know it's not going to be that simple but I'm also sure it can't be that difficult. thanks a lot I appreciate your help with my dumb brain. it's past midnight here, so it's bit difficult to think clearly LOL
  14. yes, I need a php variable for example $selected_item, and that will be the value of the selected item and that should be used in that div
×
×
  • 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.