Jump to content

jonathanbee

Members
  • Posts

    28
  • Joined

  • Last visited

    Never

Everything posted by jonathanbee

  1. well, I changed the textbox to a textarea and it works in Safari. I'd prefer not to use a textarea though...
  2. Thanks rajivgonsalves, but Safari does nothing still, works in IE and FF.
  3. That code works in all browsers, the static value gets inserted.
  4. Hi again rajivgonsalves, Sorry, to drag this on and on.. but there is no change, IE and FF work, but Safari does nothing. btw: I am testing this on both Mac and PC Safari 3.
  5. Hi again rajivgonsalves, There is no change, IE and FF work, but Safari does nothing.
  6. Hi rajivgonsalves, I have already tried using innerHTML, like so: var xxx = ajaxRequest.responseText; document.getElementById("xyz").innerHTML ="<input type='text' name='shippingAddress' id='shippingAddress' value='"+xxx+"' size='20'>"; the form code: <div id="xyx"><input type="text" name="shippingAddress" id="shippingAddress" size="20"></div> but it still doesn't populate the value field in Safari, note that this code works in IE and FF fine. I'm starting to think the textbox value cannot be updated in Safari..
  7. Hi mainewoods, Thanks, I removed all of those closing tags. I'm using an HTML doctype. I only tried this as a test; <input type="text" name="shippingAddress2" id="shippingAddress2" size="20"><div id="shippingAddress"></div></input> I did change the ID's so as not to duplicate them on the page... still not working though.
  8. Hi again mainewoods, Yes, the alert shows the correct data in Safari. I tried your suggestion about moving the code position, but the problem persisted. The original form input looks like this: <input type="text" name="shippingAddress" id="shippingAddress" size="20"></input> As a test, if I change it to this: <input type="text" name="shippingAddress2" id="shippingAddress2" size="20"><div id="shippingAddress"></div></input> and then use this code in the script: document.getElementById("shippingAddress").innerHTML = ajaxRequest.responseText;} I get the correct data appearing on the page... but I just cant get it to insert into the text box...
  9. Hi mainewoods, shippingAddress is a text box. the ajax is returning just text. While Safari is going and getting the correct data from my db, it's just not inserting it into that field I want, perhaps this has to do with how I am setting this function up? <script language="javascript" type="text/javascript"> <!-- // AJAX Browser Support Code function ajaxFunction(button){ var ajaxRequest; ajaxRequest = false; if(window.XMLHttpRequest && !(window.ActiveXObject)) { try { ajaxRequest = new XMLHttpRequest(); } catch(e) { //ajaxRequest = false; } // branch for IE/Windows ActiveX version } else if(window.ActiveXObject) { try { ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP"); } catch(e) { try { ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP"); } catch(e) { //ajaxRequest = false; } } } ajaxRequest.onreadystatechange = function(){ if(ajaxRequest.readyState == 4){ if (button == "a"){ document.checkout.shippingAddress.value = ajaxRequest.responseText;} else if (button == "b") { document.checkout.billingAddress.value = ajaxRequest.responseText;} } } // Take shippingPostcode OR billingPostcode and send it to the PHP file if (button == "a"){ var pc = document.getElementById('shippingPostcode').value;} else if (button == "b") { var pc = document.getElementById('billingPostcode').value;} var queryString = "?pc=" + pc; ajaxRequest.open("GET", "/includes/pc_query.php" + queryString, true); ajaxRequest.send(""); } //--> </script>
  10. anyone? Surely someone must know why the alert would work, but the following line does nothing.. also, the safari debug js console shows no errors.. really stumped here.
  11. Hello, this code works it IE and FF, but for Safari it does nothing. Please can someone tell me what I am doing wrong here; alert (ajaxRequest.responseText); // indicates expected value in all browsers document.checkout.shippingAddress.value = ajaxRequest.responseText;} Thanks, Jonathan
  12. I figured out how to use AJAX to query the db while the user is filling out the form
  13. If I declare this at the start: $ney = $_SERVER['PHP_SELF']; And change the form action to: <form action="<?php echo $ney?>" method="GET"> then change the else to: else if ($_GET['redirect']) { $ney = "invoice.php"; it almost works.. am I on the right track or is this totally wrong?
  14. Thanks for your reply, so... I *must* use 2 forms to accomplish this? The 1st form's action would run the function that queries the db for the address based on the postal code, the 2nd form's action would advance to the next page. But, then is there some way for me to get data from both forms if the user clicks the 2nd button?
  15. sorry, I'm sure this code is not that good, I'm still learning :-\ : <?php // check which button was clicked if ($_GET['lookup']) { $new_code = $_GET['code']; $new_telephone = $_GET['telephone']; $c_new_code = mysql_real_escape_string($new_code); $d_new_code = ereg_replace ('[^0-9]+', '',$c_new_code); $query="select * from postal_codes where code='$d_new_code'"; $result=mysql_query($query); while($row = mysql_fetch_array($result)){ $addy1 = $row['add1']; $addy2 = $row['add2']; $addy3 = $row['add3']; $faddy = "{$addy1}{$addy2}{$addy3}"; } } else { } ?> <form action="<?php echo $_SERVER['PHP_SELF'] ?>" method="GET"> <fieldset> <label>郵便場号:</label> <input type="text" name="code" value="<?php echo $new_code?>"></input> <label>都道府県市町村郡:</label> <input type="text" name="code2" value="<?php echo $faddy?>"></input> <label>電話</label> <input type="text" name="telephone" value="<?php echo $new_telephone?>"></input> </fieldset> <input type="submit" value="Find>" name="lookup"></input> <input type="submit" value="Go>" name="redirect"></input> </form>
  16. Hi there, I've been trying to figure out how I can have 2 actions on my address form. One button's action takes the postal code and queries the database for the address. The other's action proceeds to the next page. I can get either one or the other to work. But how can I get them both to work on the same page without losing the data that the user enters into the form? Thanks for any advice.
  17. can't believe shift jis worked, but this fixed it.. $c = iconv("EUC-JP", "SJIS", $comments);
  18. i think i need to convert the data to HTML Entity Codes not utf 8... i don't think htmlentities is quite what i need, is there anything else out these that might work?
  19. i have tried: $c= mb_convert_encoding($comments, "UTF-8"); but, still it won't work...
  20. I can get $comments out of the db and put it on screen fine, but when I try to email it, there is an encoding problem. So this code: $body .= "&#12467;&#12513;&#12531;&#12488;<br/>" . $comments; correctly generates this text in the email: コメント 30%アップの料金で宜しくお願い致します。 But if I take $comments from the db instead, it will not appear correctly. I am using charset=EUC-JP". Somehow I have to get $comments converted to unicode after I query the db.. Thanks for any suggestions.
  21. got it.. changed it to this: if ($_POST['process'] == 1) { $pattern = '/.*@.*\..*/'; $email = $_POST['email']; if (preg_match($pattern, $_POST['email']) > 0) { $query = "Insert into res (email) values ('$email')"; $result = mysql_query($query) or die("Insert failed"); function getMaxOrderNumber($db) { $result = $db->execute("SELECT MAX(`r_id`) FROM `" . res . "`"); return $result->fields['MAX(`r_id`)']; } $orderNumber = getMaxOrderNumber($db); $r_id = $orderNumber; $urlname = urlencode($r_id); header("location: thankyou.php?&r_id=$urlname"); } $message = "Please enter a valid email address."; $emailclass = "errortext"; }
  22. Hi, sorry for another stupid question, but I'm really stumped. I can't seem to get the maximum value of r_id to get to the next page. Please help.. <? require('includes/initialise.php'); $message = ""; $emailclass = "basictext"; if ($_POST['process'] == 1) { $pattern = '/.*@.*\..*/'; $email = $_POST['email']; $urlname = urlencode($_POST['$r_id']); if (preg_match($pattern, $_POST['email']) > 0) { $query = "Insert into res (email) values ('$email')"; $result = mysql_query($query) or die("Insert failed"); $query2 = mysql_query("SELECT MAX(`r_id`) FROM `" . res . "`"); $r_id = mysql_result ($query2, 0); header("location: thankyou.php?&r_id=$urlname"); } $message = "Please enter a valid email address."; $emailclass = "errortext"; } ?> thankyou.php: <?php require('includes/initialise.php'); $r_id = $_GET['$r_id'] ?> <body> <?php echo $r_id;?>です。<br>
  23. found the mistake, should have been '$f_time'
  24. Alright, I finally got it working and even managed to get the correct time for this time zone. Now if I could just get the data into the db, it will echo the $f_time to screen, but in the db.. it's empty.. function jtime() { $b = time () + 57600; $fixed_time = date("D, F jS G:i a",$b); return $fixed_time; } $f_time = jtime(); $query = "Insert into res (name,gender,age,country,other_country,first_time,email,f1n,f1e,f2n,f2e,comments,t_stamp) values ('$_POST[name]','$_POST[gender]','$_POST[age]','$_POST[country]','$_POST[other_country]','$_POST[first_time]','$_POST','$_POST[f1n]','$_POST[f1e]','$_POST[f2n]','$_POST[f2e]','$_POST[comments]', '$_POST[f_time]')"; Please help..
  25. Thanks for reply and advice. I will check that out. I did insert the code your posted, but it failed, I will play around with it. Any more advice would be very appreciated.
×
×
  • 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.