Jump to content

siabanie

Members
  • Posts

    76
  • Joined

  • Last visited

    Never

Everything posted by siabanie

  1. Hi guys, I have some confusion here - I am trying to create a check box where when you tick the box but forget to fill in some other fields - How can you make sure the box stays ticked when we are taken back to the application page? Here is snippets of the code: .. $error = 0; $errormsg = ""; .. if( !isset($_POST['noemail']) && (empty($_POST['email1']) || !check_text($_POST['email1'])) ) { $error = 1; $errormsg .= "Please enter your requested email address 1<br>"; $errornum[3] = 1; } if( !isset($_POST['noemail']) && (empty($_POST['email2']) || !check_text($_POST['email2'])) ) { $error = 1; $errormsg .= "Please enter your requested email address 2<br>"; $errornum[3] = 1; }.. The Form .. .. <tr> <td><input name="noemail" type="checkbox" value="noemail"> Do not want to get the E-mail address </td> </tr> <tr> <td nowrap>First Choice <input name="email1" type="text" <?php if ($_POST['action'] == "register") { echo 'value="'.$_POST['email1'].'"'; } ?>> </td> </tr> <tr> <td nowrap>Second Choice <input name="email2" type="text" <?php if ($_POST['action'] == "register") { echo 'value="'.$_POST['email2'].'"'; } ?>> </td> </tr> I tired used session e.g: <td><input name="noemail" type="checkbox" value="noemail"<?php echo ($_SESSION["noemail"]=='noemail' ? ' checked="checked"' : '');?>> but it is still did not work - can anyone please assist me what I need to edit or did wrong. Thanks.
  2. Hi guys, I was trying to use session on this - I did try to put something like: .. <form action="<?php echo $PHP_SELF;?>" method="post" name="reg1"> .. <tr> <td><input name="noemail" type="checkbox" value="noemail"<?php echo ($_SESSION["noemail"]=='noemail' ? ' checked="checked"' : '');?>> Do not want to get the E-mail address</td> </tr> <tr> <td nowrap>Enter email - 1 <input name="email__1" type="text" <?php if ($_POST['action'] == "register") { echo 'value="'.$_POST['email1'].'"'; } ?>> </td> <td nowrap>Enter email - 2 <input name="email_2" type="text" <?php if ($_POST['action'] == "register") { echo 'value="'.$_POST['email_2'].'"'; } ?>> </td> </tr> .. .. <?php session_start(); ?> .. if( !isset($_SESSION['noemail']) && (empty($_SESSION['email_1']) || !check_text($_SESSION['email_1'])) ) { echo 'You have not entered an email or hit the check box 1'; } if( !isset($_SESSION['noemail']) && (empty($_SESSION['email_2']) || !check_text($_SESSION['email_'])) ) { echo 'You have not entered an email or hit the check box 2'; } .. But it did not work....anyone can assist me what I did wrong?
  3. Thanks guys for the explanation, that's really help. This code is work fine, and it gives me the error msg when the box did not tick. if( !isset($_POST['checkbox']) && (empty($_POST['email_1']) || !check_text($_POST['emai_1_2l'])) ) { echo 'You have not entered an email or hit the check box 1 '; if( !isset($_POST['checkbox']) && (empty($_POST['email_2']) || !check_text($_POST['email_2'])) ) { echo 'You have not entered an email or hit the check box 2'; <form action="<?php echo $PHP_SELF;?>" method="post" name="reg1"> .. <tr> <td><input name="noemail" type="checkbox" value="y"> Do not want to get the E-mail address</td> </tr> <tr> <td nowrap>Enter email - 1 <input name="email__1" type="text" <?php if ($_POST['action'] == "register") { echo 'value="'.$_POST['email1'].'"'; } ?>> </td> <td nowrap>Enter email - 2 <input name="email_2" type="text" <?php if ($_POST['action'] == "register") { echo 'value="'.$_POST['email_2'].'"'; } ?>> </td> </tr> .. </form> When I try to extend it by adding another email - then when you tick the box but forget to fill in some other bits. How can we make sure the box stays ticked when you are taken back to the application page? Can someone give me an idea please? Thanks
  4. Thanks for your reply xyph, but the code if ( empty($_POST['email1']) || !check_text($_POST['email1']) && empty($_POST['noemail']) ) did not give me as I wanted - What I am trying to achieve is: If user tick the box, they do NOT have to fill in the email address field but if user did NOT tick the box, then they MUST fill in the email address otherwise an error message will shown. I was thinking to add something like this giving a value to my checkbox: <form action="<?php echo $PHP_SELF;?>" method="post" name="reg1"> .. <tr> <td><input name="noemail" type="checkbox" value="y"> Do not want to get the E-mail address</td> </tr> <tr> <td nowrap>Enter email <input name="email1" type="text" <?php if ($_POST['action'] == "register") { echo 'value="'.$_POST['email1'].'"'; } ?>> </td> </tr> .. </form> And here is the error message if user not tick the box and not fill in the email address: $error = 0; $errormsg = ""; .. .. if ($_POST['action'] == "register") { .. .. if (($_POST['email1'] == "") && ($_POST['noemail'] == "y")) { $error = 1; $errormsg .= "Please enter your requested email address<br>"; $errornum[3] = 1; } } .. .. but it did not work...any idea what I did wrong?
  5. Hi all, I wonder if anyone could give me some idea: I have a form and one of the filed is an email (must field) if empty an error message will show up: - Now I want to add a CHECKBOX where when the CHECKBPX is clicked the "must field" email will become" not must field one" (Not required field). I have this code as my snippets: <form action="<?php echo $PHP_SELF;?>" method="post" name="reg1"> .. <tr> <td><input name="noemail" type="checkbox" value="noemail"> Do not want to get the E-mail address</td> </tr> <tr> <td nowrap>Enter email <input name="email1" type="text" <?php if ($_POST['action'] == "register") { echo 'value="'.$_POST['email1'].'"'; } ?>> </td> </tr> .. </form> .. .. $error = 0; $errormsg = ""; .. .. if ($_POST['action'] == "register") { if (($_POST['email1'] == "") OR (!check_text($_POST['email1']))) { $error = 1; $errormsg .= "Please enter your requested email address<br>"; $errornum[3] = 1; } } .. Can anyone assist me what shall I add so I can achieve this please? Thanks in advance. Siabanie
  6. Yes thanks I think it's correct but when I try to run the query in PhpmyAdmin: ALTER TABLE `utf8_Alter` CHANGE `ゴルダーズグリーン` `ーン ノースロンドン` varchar( 64 ) I got an error: MySQL said: Documentation #1054 - Unknown column 'ゴルダーズグリーン' in 'utf8_Alter' The UTF-8 is set okay but not sure what I missed here..any idea?
  7. I am using phpMyAdmin to run the query and the collations said for multilingual I gotta choose UTF-8. Isn't that correct?
  8. Hi all, I like to rename my table's column. My table name is: utf8_Alter Field: Branch In the Branch field I have few columns name I tried to change the name with this query: But it didn't work. ALTER TABLE `utf8_Alter` CHANGE `ゴルダーズグリーン` `ーン ノースロンドン` varchar( 64 ) MySQL said: Documentation #1054 - Unknown column 'ゴルダーズグリーン' in 'utf8_Alter' The Collation in phphMyAdmin is :utf8_general_ci Can anyone assist me what I did wrong here? Thanks in advance.
  9. Yip, it's a little more complicated though: INSERT INTO table ( `branch` ,`address``cost` ,`type` ) VALUES ( CASE WHEN '$branch' = 'A' THEN SELECT 'D' ELSE SELECT '$branch' END,'$address','$cost','$type','' ) Is how I think it would look, but I'm not sure about the use of SELECT... Thanks...but yes quite tricky - the thing is I use array for my branch e;g branch[] So perhaps I can avoid these?
  10. Great ideas guys, thanks a lot! Will try and working on it! Thanks!
  11. Hmmm I insert the records using PHP script something like this e.g: .. $sql_query = "INSERT INTO ".TABLE_PRO." (`branch` ,`address``cost` ,`type`) VALUES ( '$branch','$address','$cost','$type','')"; ..
  12. Ok thanks!... What do you mean by that? Can you show me an example please. Thanks
  13. I see yes I got no record when I run that query - thanks. So that means every time there is a new record in A I will have to run this UPDATE query then? - Can I just move all the records in A into D, isn't much better instead of having to update it every time there is a new record found in A? What you think?
  14. Oh yes silly me!! you were right Muddy_Funster. I just run and it seems work now thanks. Is that mean that all the data in A now been has been placed in D and rename it from A to D as well? Thanks!
  15. I have it set on utf8_general_ci - I think that is the mutlilingual char already?
  16. I have tried them but I got an error MySQL said: Documentation #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'table SET branch='ゴルダーズグリーン' WHERE branch='フィンムthe "フィンãƒ" bit cannot be read as it's in different character (Japanese rather, the A, B, C, D, E are just an example) Any idea what mistake I did here?
  17. Hi all, I would like to ask if anyone could help me about updating table. I have a table name: Property. And have 5 fields: ID, Branch, Cost, Type, Add. In the Branch field I have 5 different values: A, B, C, D, E Now I like to move ALL the data that I have in A to D and delete the A. I do not want to lost all the data I have in A nor in D - I just like to move A to D. Is mySql query here correct? mysql query UPDATE table SET branch='D' WHERE branch='A'; Can anyone please assist me? Thanks in advance..!
  18. No it is not resolved spiderwell, yes the code at the top but here it is again: Snippets of the form fields <?php session_start(); $_SESSION['email'] = ''; $_SESSION['email_1'] = ''; .. .. ?> .. .. <tr> <td bgcolor="#F6F6F6">E-mail<span class="green"> *</span></td> <td colspan="2" bgcolor="#FFFFFF"><input name="email" type="text" size="40" value="<?php echo $_SESSION["email"];?>" /> <td> </tr> <tr> <td bgcolor="#F6F6F6">Retype E-mail<span class="green"> *</span></td> <td colspan="2" bgcolor="#FFFFFF"><input name="email_1" type="text" size="40" value="<?php echo $_SESSION["email_1"];?>" /> <td> </tr> .. .. //If first email address is empty show error msg - Work fine. $('[name=email]').parent().removeClass('error'); if($('[name=email]').val()==""){ error_num++; error_mesg += "E-mail。\n"; $('[name=email]').parent().addClass('error'); } //If second email address is empty show error msg - Work fine. $('[name=email_1]').parent().removeClass('error'); if($('[name=email_1]').val()==""){ error_num++; error_mesg += "Please confirm your email\n"; $('[name=email_1]').parent().addClass('error'); } //If the first email and the second email address NOT match show error msg - NOT working yet $('[name=email_1]').parent().removeClass('error'); if($('[email != email_1]').val()){ error_num++; error_mesg += "E-mail not match\n"; $('[name=email_1]').parent().addClass('error'); } So I thought I tried this again but still not working: $('[name=email]').parent().removeClass('error') && $('[name=email_1]').parent().removeClass('error'); if($('[name=email != name=email_1]').val()){ error_num++; error_mesg += "E-mail not match\n"; $('[name=email]').parent().addClass('error') && $('[name=email_1]').parent().addClass('error'); } Maybe the way I coding isn't correct or something..? Any idea? Thanks.
  19. The snippets of the code is already on post#57 above - Anyway thanks and good luck with your prelims.
  20. Hmmm? Can you show me how please? :confused:
  21. Yes would be good idea but the problem is; the code has been already implemented in jQuery for error messages and by doing in JS mean I have to change everything and adding the new functions etc.
  22. Yes I am pretty new on this so I do not know much about it...
  23. Thanks ZulfadlyAshBurn, But what I need is just JS to determine if both email addresses are match or not. I do not need the function at the moment just want both of them match otherwise error message: I tried to do something like this: //If first email address is empty show error msg $('[name=email]').parent().removeClass('error'); if($('[name=email]').val()==""){ error_num++; error_mesg += "E-mail。\n"; $('[name=email]').parent().addClass('error'); } //If second email address is empty show error msg $('[name=email_1]').parent().removeClass('error'); if($('[name=email_1]').val()==""){ error_num++; error_mesg += "Please confirm your email\n"; $('[name=email_1]').parent().addClass('error'); } //If first email and second email address not match show error msg $('[name=email_1]').parent().removeClass('error'); if($('[email != email_1]').val()){ error_num++; error_mesg += "E-mail not match\n"; $('[name=email_1]').parent().addClass('error'); } The first and second JS (when fields are empty) are giving me an error which is correct but the third one did not work. I am not exactly sure how it should be written. I tried I need to add something like this: $('[name=email]').parent().removeClass('error') && $('[name=email_1]').parent().removeClass('error'); if($('[name=email != name=email_1]').val()){ error_num++; error_mesg += "E-mail not match\n"; $('[name=email]').parent().addClass('error') && $('[name=email_1]').parent().addClass('error'); } ...but it did not work.....anyone please?
  24. Sorry yes I mean in JS but if you could show me in PHP would be great as I heard that PHP is much secure than JS? - I would be grateful if you could assist me how I can implemented it in JS please. Thanks.
  25. Hi all, I need some favour about checking if the first email that user entered was match with the confirmation email otherwise show an error message: "The email address is not match" or something like that.. Here is the snippets of error checking for email and email_1 if it is empty - but I don't know how I can add another validate if both of the emails match or not? And do I need to add them in PHP code? Please suggest, any help would be highly appreciated. .. .. $('[name=email]').parent().removeClass('error'); if($('[name=email]').val()=="" || $('[name=email_1]').val()==""){ error_num++; error_mesg += "Please enter E-mail\n"; $('[name=email]').parent().addClass('error'); //if($('[name=tel_p2]').val()=="" ) } .. Form HTML + PHP .. <tr> <td bgcolor="#F6F6F6">E-mail<span class="green"> *</span></td> <td colspan="2" bgcolor="#FFFFFF"><input name="email" type="text" size="40" value="<?php echo $_SESSION["email"];?>" /> <td> </tr> <tr> <td bgcolor="#F6F6F6">E-mail Confirmation<span class="green"> *</span></td> <td colspan="2" bgcolor="#FFFFFF"><input name="email" type="text" size="40" value="<?php echo $_SESSION["email"];?>" /> <td> </tr> ... Thanks alot.
×
×
  • 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.