Jump to content

jonnewbie12

Members
  • Posts

    35
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

jonnewbie12's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Pointless Moderator with pointless 'advice'. If you want to keep novices from 'bumping up' your posts maybe you should moderate as the title suggests and allow only those with sufficient knowledge to become members, otherwise FRO you patronising little nerd! I said I was lawyer as it may have caused the rude idiot who was calling me lazy to think again. We don't generally fall into the 'cant be bothered' category. As for your joke I am sure you will sleep well in the knowledge that you cause so much laughter to so few! Can't believe you have taken the time to dissect my post line by line without giving a iota of actual advice. Says it all really. Get a life!
  2. Thank You I will have a look. I appreciate not understanding why my form doesn't provide a value to a PHP script is probably child's play, but people come to me every day for advice from all walks of life and I try to accommodate as best I can. When someone is clearly wasting my time because they are too lazy to help themselves I point it out but I don't judge before I know the person and the reason they are asking. I will go and continue browsing the net to find answers as I have done for the most part. Its' only after hours of frustration that I post a topic in the hope a simple answer will materialise. Even the most basic answers are part of the learning process. Thank you anyway. The forum has actually been very useful.
  3. Well thank you for your help! Trying? That's annoying.! Considering I am a full time criminal defence lawyer and designing a site with no training whatsoever, I would consider my efforts to be a little more than "not trying". But I guess you have all the time in the world! Shame really because everyone has been so accommodating including you until now. Sets a bad example for the forum to be rude. You could simply not respond if you felt you were being "used".
  4. Thank you. You were right if I posted widthcheck at a certain value it worked. <?php $_POST['widthcheck'] = '200';?> Problem I have is that widthcheck is based on a form variable that does not post to the database. Ok at the risk of sounding like a total numpty here is the dliemna. 1. When the user enters a number in the form in the width field, I want it to post that value to widthcheck. I can do that using normal html setting the text field but that doesn't seem to send the value to PHP. 2. After the user enters a value in the form in the drop field and presses submit the validation runs which includes a comparison to the widthcheck field which shows a value in html (by virtue of the set text field html) but presumably has not been posted to PHP? Obviously there is PHP and html wrapped up together here. I know you will probably tell me to go and read a book but I am at the very end of the site and would really appreciate a pointer.
  5. Thanks Dan Guess the colon distinction is quite important in this arena. Appreciate a comparison and echo are different but how else do I know what values are being compared ? Am using Post and recordset in the same line as one variable comes from a from and another comes from the database. The error reporting is within a spry validation script so not sure PHP.ini would make much difference?
  6. Thanks and sorry for 'bumping' I have echoed the values and they are correct. The code is in line with some script as follows: I have copied Pickachus code into it and also tried the inline code but to no avail sadly. <span id="sprytextfield3"> <label for="drop"></label> <input name="drop" type="text" id="drop" value="<?php echo $_POST["drop1"]; ?>" size="5" maxlength="5" /> <br /> <span class="textfieldMinValueMsg">Min Drop = 1cm</span><span class="textfieldMaxValueMsg">Max Drop = <?php if( $row_Recordset4['multidirection'] == "yes" && $_POST["widthcheck"] < $row_Recordset4['drop'] ) { echo $row_Recordset4['width']; } else { echo $row_Recordset4['drop']; } ?>cm</span><span class="textfieldInvalidFormatMsg">Invalid format.</span></span> The script text at the bottom of the page is: <script type="text/javascript"> var sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1"); var sprytextfield2 = new Spry.Widget.ValidationTextField("sprytextfield2", "integer", {isRequired:false, minValue:40, maxValue:<?php echo $row_Recordset4['width']?>}); var sprytextfield3 = new Spry.Widget.ValidationTextField("sprytextfield3", "integer", {isRequired:false, minValue:1, maxValue:<?php if( $row_Recordset4['multidirection'] == "yes" && $_POST["widthcheck"] < $row_Recordset4['drop'] ) { echo $row_Recordset4['width']; } else { echo $row_Recordset4['drop']; } ?>}); </script> When the two first conditions are met, namely the "multidirection"=yes and the "widthcheck" is lower than the "drop" (and I have echoed these) it returns the correct value using the "width" field. However when the "widthcheck: is higher and therefore BOTH conditions are not met it does not trigger the ELSE command and returns the same "width value".
  7. Thanks, added the colon but no change: It always returns the first value echo $row_Recordset4['width'] even if both conditions are not met.
  8. Can someone please tell me what i have got wrong here? I am trying to return value C if conditions a AND B are met or return value D. Not sure if its parenthesis or something else? <?php if (($row_Recordset4['multidirection']=="yes") && ($_POST["widthcheck"] < $row_Recordset4['drop'])) echo $row_Recordset4['width'];else echo $row_Recordset4['drop'] ?> Thanks
  9. Does anyone know if you can incorporate PHP forms with Spry validation? The basic spry text field that validates a number between say 1 and 300 works and is as follows: <script type="text/javascript"> var sprytextfield2 = new Spry.Widget.ValidationTextField("sprytextfield2", "integer", {validateOn:["blur"], isRequired:false, minValue:40,maxValue:}); What I want is the max value to come from a form using PHP. Weirdly I can get it working from a recordset as follows: <script type="text/javascript"> var sprytextfield2 = new Spry.Widget.ValidationTextField("sprytextfield2", "integer", {validateOn:["blur"], isRequired:false, minValue:40,maxValue:<?php echo $row_Recordset4['max']?>}); </script> What I cant get is the value to come from a PHP form as follows. It just doesnt work? <script type="text/javascript"> var sprytextfield2 = new Spry.Widget.ValidationTextField("sprytextfield2", "integer", {validateOn:["blur"], isRequired:false, minValue:40,maxValue:<?php echo $_POST["max"]?>}); </script>
  10. Well thank you all for your help. As I said I am a newbie. I didn't appreciate the doc types and <head> were outputting html. You are right, back to the drawing board but at least it works. Thank you all
  11. this is the code as copied from the example in my test page: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Untitled Document</title> </head> <body> <?php if( $_SERVER['REQUEST_METHOD'] == 'POST' ) { $err = array(); if( empty($_POST['name']) ) $err['name'] = 'Name is a required field'; elseif( !preg_match('/^[a-z]++$/i', $_POST['name']) ) $err['name'] = 'Name can only be letters'; if( empty($_POST['email']) ) $err['email'] = 'Email is a required field'; elseif( !preg_match('/@/', $_POST['email']) ) $err['email'] = 'Email must contain @ symbol'; if( empty($err) ) { //function_to_process_data(); //header( 'Location: http://yoursite.com/success.php' ); echo header ('Location: http://www.mysite/template5.php' ); exit(); } } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>form</title> </head> <body> <form method="post" action="<?php echo $_SERVER['SCRIPT_NAME']; ?>"> <label>Name: <input type="text" name="name" value="<?php if(isset($_POST['name'])) echo htmlspecialchars($_POST['name']); ?>"></label> <?php if(isset($err['name'])) echo '<span style="color: red;">'.$err['name'].'</span>' ?> <br> <label>Email: <input type="text" name="email" value="<?php if(isset($_POST['email'])) echo htmlspecialchars($_POST['email']); ?>"></label> <?php if(isset($err['email'])) echo '<span style="color: red;">'.$err['email'].'</span>' ?> <br> <input type="submit"><input type="reset"> </form> </body> </html> </body> </html>
  12. XYPH I have had a good look at the example, thank you and can happily adapt it but no joy In fact I have copied into a new clean page and tried putting the full url of my site in the PHP code. It still comes back with the same error message. Sorry
  13. Doesnt matter where I put the code: <?php header('location:http://www.mysite.co.uk'); ?> I just keep getting this message Warning: Cannot modify header information - headers already sent by (output started at /websites/my host/LinuxPackage22/mysite.co.uk/public_html/form2.php:73) in /websites/myhost/LinuxPackage22/mysite.co.uk/public_html/form2.php on line 73
  14. Sorry totally confused now: Have looked at AJAX and seems like a huge learning curve and only works on most recent browsers. Not sure what you mean by setting the header beforehand? Best chance of keeping this within the realsm of my limited knowlede is to try and keep to PHP. I thought this was quite a simple process but maybe I am not making myself clear enough. All I want to do is the following: 1. User inputs some info into a form field (for my purposes 'width') 2. User presses submit button on form 3. If width equals a certain value or is empty a message is displayed on same page saying value is wrong or empty 4. If width value is ok (i.e. validated), form is submitted to a different page where the value can then be displayed. The form validation by itself seems easy enough providing you don' want to return two different outcomes depending on the submitted form. Happy for anyone to take this from a fresh perspective and start from scratch but at the moment I am totally confused? Sorry to take your time up with this.
×
×
  • 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.