Jump to content

siabanie

Members
  • Posts

    76
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

siabanie's Achievements

Member

Member (2/5)

0

Reputation

  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?
×
×
  • 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.