Jump to content

jonnewbie12

Members
  • Posts

    35
  • Joined

  • Last visited

    Never

Everything posted by jonnewbie12

  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.
  15. I think whats happening is that the PHP code is returning an empty value in the width box as the form has not submitted itself prior to the PHP query. On the second attempt it works as the form has now submitted the value so it directs to the right page. Is it possible then to: 1. Enter the width value 2. Submit the form to itself 3. Then run the PHP code in the action button query the value of the width field 4. If the with value is =1 resubmit and it will go to template5.php. 5. If the width value is not 1 it will resubmit to itself again. Problem is I want all this done in one click?? AHGGG
  16. Thanks Gotharius. Don't know anything about Ajax so will try and work with PHP if all else fails will go there. Pickahu: I have tried the following script in the form action button so that if the width is 1 it submits to one url and if not it submits to another: Is that what you meant? It still doesn't seem to work when i is entered though and always submits to the 'template5.php' <form id="form1" name="form1" method="post" action=<?php if ($_POST['width']==1) echo "template3formvalidation.php"; else echo "template5.php";?>>
  17. Header doesnt work. Error code says I cannot modify header information
  18. Thank you Pickachu thats exactly what I mean. If the form validation is successful I want to the page to submit the form to a new URL. If the validation is unsuccessful I want it to submit to itself and display the error message. Can you include PHP in the "action" function of the form so it says only submit if validation is successful? HOw would you do that for example? p.s. I will try the 'header' idea now too
  19. Hi. Pretty straight forward I guess but as the name suggests am a newbie. I have a form that requires the user to enter certain parameters. If the values are blank it submits to itself and loads the error messages. What I want to do is create PHP code that submits the form to a different url. What I thought was create two forms (the second with hidden fields replicating the first form), each form having a different url in the action"" code. What I cant work out is the PHP IF ELSE code to submit form 2 if Form1 is is validated correctly. This is the PHP code relevant to the form validation. Help? <?php //If form was submitted if ($_POST['submitted']==1) { $errormsg = ""; //Initialize errors if ($_POST[width]){ $title = $_POST[width]; //If title was entered } else{ $errormsg = "Please enter width"; } if ($_POST[drop]){ $textentry = $_POST[drop]; //If comment was entered } else{ if ($errormsg){ //If there is already an error, add next error $errormsg = $errormsg . " & content"; }else{ $errormsg = "Please enter drop"; } } } if ($errormsg){ //If any errors display them echo "<div class=\"box red\">$errormsg</div>"; } //If all fields present if ($title && $textentry){ //Do something echo 'THIS IS WHERE I WANT THE CODE TO SUBMIT FORM 2 or SUBMIT FORM 1 TO A DIFFERENT URL'; } ?>
  20. Got it thanks. there was a : instead of ; after image in second code. Thanks very much for your help. I love this site
  21. Sadly neither of these two ideas seem to work and have tried putting the full http:// path in for the graphic. Can you think of anything else that may be wrong?
  22. Hi again probably a very simple code but not working. I am trying to show a default image "fabric.jpg" if the recordset is empty. If not empty it shows the recordset image at a size of 100X100. This is the code I am using and have probably left something out, any ideas? <img src="<?php if ($row_Recordset3['fabricpicture']==null); echo "<img src='graphics/fabric.jpg'>"; ?>" alt="" name="fabric" width="100" height="100" border="0" align="bottom" id="fabric" title="Selected Bottom Up Blind Fabric" /> I have tried switching the img scr both "" and ' ' but still no joy?
  23. easy to say and I am using CSS but I cant work out what the code is to change the background. Not sure how to define the table. Is it a get element ID or a table.id.background-image or some other code to point to the actual table? Sorry for being a div but I know how to change the image and how to use CSS but I am having trouble trying to work out the the actual function that will change the property when clicked or hovered?
  24. I am designing a PHP page in dreamweaver CS5. I have a tabe with a background image. Is there a simple code that will allow me to change the image preferably on a hover or a click. Ideally I want to get the image from the database using echo function. I have called the table ID "td1". Table code is: <table width="89%" border="0" cellpadding="0" cellspacing="2" style="background:url(graphics/colourboxcream.png) no-repeat" id="td1"> Please, please, help
×
×
  • 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.