Jump to content

john_6767

Members
  • Posts

    99
  • Joined

  • Last visited

    Never

Everything posted by john_6767

  1. ahh, i get it now, i'll have a play with it and let you guys know how i go..
  2. ok, it looks like this now, but doesn't work yet.. [code] <script language="JavaScript"> function loadNewPageFunc(){ document.checkout_form.action='checkout_confirm.php'; document.checkout_form.submit();} </script>[/code] do i need the semicolons still? I have seen functions that don't have them at the end of every line.
  3. ok ihave tried to do that but unsuccessful so far, i have put this code in the else so that the function is called [code]  print "<script language=\"JavaScript\">"; print "loadNewPageFunc();"; print "</script>";[/code] then i have put after the form [code] <script language="JavaScript"> function loadNewPageFunc() document.checkout_form.action='checkout_confirm.php'; document.checkout_form.submit(); </script>[/code]
  4. the javascript is only being used to redirect to the next page.. is this ok?
  5. my validation script is one of the include files in the top of that code i posted a few posts back, its php by webassist so its pretty secure. Here's the code thats on the page, the stuff in the inlcudes just validates.. This is the bit i need to post the form to the next page if the validation passes... [code]<?php require_once("WA_ValidationToolkit/WAVT_Scripts_PHP.php"); ?> <?php require_once("WA_ValidationToolkit/WAVT_ValidatedForm_PHP.php"); ?> <?php $chandlery->GetContent(); ?> <?php if (isset($_POST["Checkout"]))  {  $WAFV_Redirect = "checkout.php";  $_SESSION['WAVT_checkout'] = "";  if ($WAFV_Redirect == "")  {    $WAFV_Redirect = $_SERVER["SCRIPT_NAME"];  }  $WAFV_Errors = "";  $WAFV_Errors .= WAValidateRQ(((isset($_POST["Name"]))?$_POST["Name"]:"") . "",true,1);  $WAFV_Errors .= WAValidateEM(((isset($_POST["Email"]))?$_POST["Email"]:"") . "",true,2);  $WAFV_Errors .= WAValidateCC(((isset($_POST["CreditCardNo"]))?$_POST["CreditCardNo"]:"") . "","4:51:52:53:54:55:34:37:30:36:38:",true,3);  $WAFV_Errors .= WAValidateRQ(((isset($_POST["CreditCardType"]))?$_POST["CreditCardType"]:"") . "",true,4);  if ($WAFV_Errors != "")  {    PostResult($WAFV_Redirect,$WAFV_Errors,"checkout");  }  else {   print "<script language=\"JavaScript\">"; print "document.checkout_form.action='checkout_confirm.php'"; print "document.checkout_form.submit()"; print "</script>";  } } ?>[/code]
  6. mm.. sounds smart, but is there anyway to do it the way i was headed? Its just I had the pages going fine without validation..
  7. [quote author=nethnet link=topic=102932.msg409315#msg409315 date=1154661854] I think I get what you're saying, but it still doesn't make sense as to why you need this to be done by the Javascript. [/quote] how would i do this in php? I am only new to it.. would that be a better way to do it?
  8. no, if u were to put for the form [code]<form name="checkout_form" method="POST" action="checkout_confirm.php">[/code] then it would load the next page fine, but my validation script would not be run, i.e. you could pass blank or incorrect values to the next page.. This is why i have removed the action from the form and am trying to put it in so that it is run after the validation script is run..
  9. i think i know what u are saying.. i tried it like this anyway and it didn't work either.. [code]print "<script language=\"JavaScript\">"; print "document.checkout_form.action='checkout_confirm.php';"; print "document.checkout_form.submit();"; print "</script>";[/code]
  10. aren't these semicolons? Do they have to be inside the php also?
  11. if that standard form tag has an action set then the validation is bypassed.. i can get it to work with no validation. this is why i have put the javascript in the php else. the else checks to see if there are any errors and if there aren't then i want to post the form to the next page.. Is it possible to do what i am trying to do or is there a better way to do it?
  12. basically if that  else where i commented runs then i want it to load the next page and pass it the form values in my form on that next page..
  13. ok heres the code [code]<?php //WA eCart Include require_once("WA_eCart/chandlery_PHP.php"); ?> <?php require_once("WA_ValidationToolkit/WAVT_Scripts_PHP.php"); ?> <?php require_once("WA_ValidationToolkit/WAVT_ValidatedForm_PHP.php"); ?> <?php $chandlery->GetContent(); ?> <?php if (isset($_POST["Checkout"]))  {   $WAFV_Redirect = "checkout.php";   $_SESSION['WAVT_checkout'] = "";   if ($WAFV_Redirect == "")  {     $WAFV_Redirect = $_SERVER["SCRIPT_NAME"];   }   $WAFV_Errors = "";   $WAFV_Errors .= WAValidateRQ(((isset($_POST["Name"]))?$_POST["Name"]:"") . "",true,1);   $WAFV_Errors .= WAValidateEM(((isset($_POST["Email"]))?$_POST["Email"]:"") . "",true,2);   $WAFV_Errors .= WAValidateCC(((isset($_POST["CreditCardNo"]))?$_POST["CreditCardNo"]:"") . "","4:51:52:53:54:55:34:37:30:36:38:",true,3);   $WAFV_Errors .= WAValidateRQ(((isset($_POST["CreditCardType"]))?$_POST["CreditCardType"]:"") . "",true,4);   if ($WAFV_Errors != "")  {     PostResult($WAFV_Redirect,$WAFV_Errors,"checkout");   }   //this is where it is not working for me... else {   print "<script language=\"JavaScript\">"; print "document.checkout_form.action='checkout_confirm.php'"; print "document.checkout_form.submit()"; print "</script>";   } //end of where its not working... } ?> <?php // WA eCart Redirect if ($chandlery->redirStr != "")    {   header("Location: ".$chandlery->redirStr); } ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>Newcastle Rigging & Chandlery</title> <?php $currentPageGroup = "images/nav/online_shop.gif"; ?> <?php     if ($chandlery->DisplayInfo("Name") <> "") {     } else {         print "<script language=\"JavaScript\">"; print "window.location = 'shopping_cart.php?Action=checkoutFailed' "; print "</script>";     } ?> <link href="styles/nrc.css" rel="stylesheet" type="text/css"> <script type="text/JavaScript"> <!-- function GP_AdvOpenWindow(theURL,winName,features,popWidth,popHeight,winAlign,ignorelink,alwaysOnTop,autoCloseTime,borderless) { //v2.0   var leftPos=0,topPos=0,autoCloseTimeoutHandle, ontopIntervalHandle, w = 480, h = 340;    if (popWidth > 0) features += (features.length > 0 ? ',' : '') + 'width=' + popWidth;   if (popHeight > 0) features += (features.length > 0 ? ',' : '') + 'height=' + popHeight;   if (winAlign && winAlign != "" && popWidth > 0 && popHeight > 0) {     if (document.all || document.layers || document.getElementById) {w = screen.availWidth; h = screen.availHeight;} if (winAlign.indexOf("center") != -1) {topPos = (h-popHeight)/2;leftPos = (w-popWidth)/2;} if (winAlign.indexOf("bottom") != -1) topPos = h-popHeight; if (winAlign.indexOf("right") != -1) leftPos = w-popWidth; if (winAlign.indexOf("left") != -1) leftPos = 0; if (winAlign.indexOf("top") != -1) topPos = 0;     features += (features.length > 0 ? ',' : '') + 'top=' + topPos+',left='+leftPos;}   if (document.all && borderless && borderless != "" && features.indexOf("fullscreen") != -1) features+=",fullscreen=1";   if (window["popupWindow"] == null) window["popupWindow"] = new Array();   var wp = popupWindow.length;   popupWindow[wp] = window.open(theURL,winName,features);   if (popupWindow[wp].opener == null) popupWindow[wp].opener = self;    if (document.all || document.layers || document.getElementById) {     if (borderless && borderless != "") {popupWindow[wp].resizeTo(popWidth,popHeight); popupWindow[wp].moveTo(leftPos, topPos);}     if (alwaysOnTop && alwaysOnTop != "") {     ontopIntervalHandle = popupWindow[wp].setInterval("window.focus();", 50);     popupWindow[wp].document.body.onload = function() {window.setInterval("window.focus();", 50);}; }     if (autoCloseTime && autoCloseTime > 0) {     popupWindow[wp].document.body.onbeforeunload = function() {   if (autoCloseTimeoutHandle) window.clearInterval(autoCloseTimeoutHandle);     window.onbeforeunload = null; }    autoCloseTimeoutHandle = window.setTimeout("popupWindow["+wp+"].close()", autoCloseTime * 1000); }   window.onbeforeunload = function() {for (var i=0;i<popupWindow.length;i++) popupWindow[i].close();}; }    document.MM_returnValue = (ignorelink && ignorelink != "") ? false : true; } //--> </script> </head> <body> <div id="contents"> <table width="740" border="0" align="center" cellpadding="0" cellspacing="0">   <tr>     <td height="120">&nbsp;</td>   </tr>   <tr>     <td valign="top" class="content">       <h1>checkout</h1>       <form name="checkout_form" method="POST">         <?php $chandlery_Index = $chandlery->DisplayIndex - 1;?>         <?php while (!$chandlery->EOF())      { ?>           <?php $chandlery_Index ++;?>           <input type="hidden" name="ID_<?php echo $chandlery_Index; ?>" value="<?php echo $chandlery->DisplayInfo("ID") ?>">           <input type="hidden" name="Name_<?php echo $chandlery_Index; ?>" value="<?php echo $chandlery->DisplayInfo("Name") ?>">           <input type="hidden" name="Description_<?php echo $chandlery_Index; ?>" value="<?php echo $chandlery->DisplayInfo("Description") ?>">           <input type="hidden" name="Weight_<?php echo $chandlery_Index; ?>" value="<?php echo $chandlery->DisplayInfo("Weight") ?>">           <input type="hidden" name="Quantity_<?php echo $chandlery_Index; ?>" value="<?php echo $chandlery->DisplayInfo("Quantity") ?>">           <input type="hidden" name="Price_<?php echo $chandlery_Index; ?>" value="<?php echo $chandlery->DisplayInfo("Price") ?>">           <input type="hidden" name="Colour_<?php echo $chandlery_Index; ?>" value="<?php echo $chandlery->DisplayInfo("Colour") ?>">           <input type="hidden" name="Size_<?php echo $chandlery_Index; ?>" value="<?php echo $chandlery->DisplayInfo("Size") ?>">           <?php   $chandlery->MoveNext(); } $chandlery->MoveFirst(); ?>         <table cellpadding="0" cellspacing="0" class="tableForm">           <tr>             <th> Name</th>               <td><input name="Name" type="text" class="formTextField" value="<?php echo(ValidatedField("checkout","Name")) ?>"></td>               <td><?php if (ValidatedField("checkout","checkout"))  {   if ((strpos((",".ValidatedField("checkout","checkout").","), "," . "1" . ",") !== false || "1" == ""))  {     if (!(false))  { ?>                 <img src="images/error.gif" width="14" height="14"> Please enter your name               <?php //WAFV_Conditional checkout.php checkout(1:)     }   } }?></td>             </tr>           <tr>             <th> Email</th>               <td><input name="Email" type="text" class="formTextField" value="<?php echo(ValidatedField("checkout","Email")) ?>"></td>               <td><?php if (ValidatedField("checkout","checkout"))  {   if ((strpos((",".ValidatedField("checkout","checkout").","), "," . "2" . ",") !== false || "2" == ""))  {     if (!(false))  { ?>                 <img src="images/error.gif" width="14" height="14"> Please enter a valid email               <?php //WAFV_Conditional checkout.php checkout(2:)     }   } }?></td>             </tr>           <tr>             <th> Credit Card No.</th>               <td><input name="CreditCardNo" type="text" class="formCreditCardField" value="<?php echo(ValidatedField("checkout","CreditCardNo")) ?>"></td>               <td><?php if (ValidatedField("checkout","checkout"))  {   if ((strpos((",".ValidatedField("checkout","checkout").","), "," . "3" . ",") !== false || "3" == ""))  {     if (!(false))  { ?>                 <img src="images/error.gif" width="14" height="14"> Please enter your credit card number               <?php //WAFV_Conditional checkout.php checkout(3:)     }   } }?></td>             </tr>           <tr>             <th> Card Type</th>               <td><select name="CreditCardType" class="formDropDownField" id="CreditCardType">                 <option value=" " <?php if (!(strcmp(" ", (ValidatedField("checkout","CreditCardType"))))) {echo "selected=\"selected\"";} ?>> </option>                 <option value="VISA" <?php if (!(strcmp("VISA", (ValidatedField("checkout","CreditCardType"))))) {echo "selected=\"selected\"";} ?>>VISA</option>                 <option value="MasterCard" <?php if (!(strcmp("MasterCard", (ValidatedField("checkout","CreditCardType"))))) {echo "selected=\"selected\"";} ?>>MasterCard</option>                 <option value="AMEX" <?php if (!(strcmp("AMEX", (ValidatedField("checkout","CreditCardType"))))) {echo "selected=\"selected\"";} ?>>AMEX</option>                 <option value="Diners" <?php if (!(strcmp("Diners", (ValidatedField("checkout","CreditCardType"))))) {echo "selected=\"selected\"";} ?>>Diners</option>               </select></td>               <td><?php if (ValidatedField("checkout","checkout"))  {   if ((strpos((",".ValidatedField("checkout","checkout").","), "," . "4" . ",") !== false || "4" == ""))  {     if (!(false))  { ?>                 <img src="images/error.gif" width="14" height="14"> Please select your card type               <?php //WAFV_Conditional checkout.php checkout(4:)     }   } }?></td>             </tr>           <tr>             <td>&nbsp;</td>               <td align="right"><input name="Checkout" type="submit" class="formCartButton" onMouseOver="this.className='formCartButtonOver';" onMouseOut="this.className='formCartButton';" value="Preview Purchase"></td>               <td align="right">&nbsp;</td>             </tr>           </table>       </form>      <h1>&nbsp;</h1></td>   </tr> </table> </div> </body> </html> [/code]
  14. if i use an action the form is passed fine but the server side script on the page is bypassed..
  15. I'm trying to submit a form in my php by using this javascript but it doesn't seem to be working, all that happens is the page appears to reload again leaving me blank fields. I cannot use the standard form action becasue i am using server side validation.. any suggestions? I've been trying different things for days with no result. [code]  else { print "<script language=\"JavaScript\">"; print "document.checkout_form.action='checkout_confirm.php'"; print "document.checkout_form.submit()"; print "</script>"; } [/code]
  16. ok, i'm trying to get multiple checkboxes going and i think i have everything sorted except i cannot check to see if the checkbox is checked, the checkboxes are dynamic so i cannot type in the name as it changes so what i was trying to do is //start loop if (isset($_POST['checkboxName_$variable'])) { //add checkbox to database } //end loop where $variable is a number i put after every checkbox to make them unique. So why isn't it working (is it due to having a variable in the post['']) and how could i do the checkbox check differently? Also my logic for this system above is that a checkbox only comes trhough if it is checked, and i add it to the db if checkbox is checked but not if not checked. Anyone see any potential problems, cheers
  17. hi, thanks for your reply. I don't think i explained it clearly enough, I want to show the items in a list which i can do, and have the items that are in the database field already selected in the list when page loads.. so the results is i end up with a list that has all the items available and some of them (the ones in database) are the only ones selected.
  18. hi, i have an add page where i fill out text fields and select multiple items from a list box and then add these to a database field. My problem is that i have a seperate edit page where i am trying to display this data again and don't know how to display the list items that were selected highlighted and in the list as well as the options from the add page so the user can update the field.. I'm not sure if i have explained this clearly enough, on the edit page i have all the fields from the add page shown so they can be updated, I have no problem showing in the text areas the values that are in the database but don't know how to do this for the list field, (doing this with checkboxes would also be ok but again i'm not sure how to show which checkboxes are selected using only one db field) cheers
  19. [!--quoteo(post=377227:date=May 26 2006, 03:20 PM:name=poirot)--][div class=\'quotetop\']QUOTE(poirot @ May 26 2006, 03:20 PM) [snapback]377227[/snapback][/div][div class=\'quotemain\'][!--quotec--] Oh that's true. In this case: [code]// Previous: SELECT id FROM `table` WHERE id < CURRENT LIMIT 1 // Next: SELECT id FROM `table` WHERE id > CURRENT LIMIT 1[/code] Should work. [/quote] cheers, i get the idea, but i have been using dreamweaver to create my sql statements, could you please let me know how i would put this on a page., i.e. what goes before and at end of this statement in the php tags. I am a complete newbie.. but i should catch its just i've never done sql statements in php before.. thanks for your advice,
  20. [!--quoteo(post=377219:date=May 26 2006, 02:55 PM:name=poirot)--][div class=\'quotetop\']QUOTE(poirot @ May 26 2006, 02:55 PM) [snapback]377219[/snapback][/div][div class=\'quotemain\'][!--quotec--] I can't understand you. Can't you just create a Previous and Next based on the current (Previous = ID-1 | Next = ID+1)? [/quote] I don;t think that will work as the id's aren't guaranteed to be consecutive numbers.. its from a db (so if i have ID's 1 2 3 4 and then i delete ID 3 i have the ID's 1 2 4 in which case when i click next on ID 2 i would get an error, yes?). Please correct me if i am wrong, i am sure there has to be an easy way to do this i'm just not seeing it.. cheers
  21. hey, just started using php and was wondering how i can select a specific record from a recordset (i used to do this in asp). To put you in the picture i have a photo gallery which is a page that diplsays a whole heap of thumbnails form a db, i have another page that loads when a thumbnail is clicked and shows the full version of the image. i want to get this page with the full image to have a previous and next image button which is where i come unstuck.. at the moment both page recordsets are just sorted by imageID and so the previous/next work on the large image page but i can't get the page to show the image from the page before..(it just shows the first imageID, i have a repeat region on the page set to 1..) i assume there is a standard way to do this and its pretty easy? Am i going about this the wrong way? thanks in advance.. -John
×
×
  • 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.