Jump to content

flyersun

Members
  • Posts

    35
  • Joined

  • Last visited

    Never

Everything posted by flyersun

  1. I'm sorry first I wanna say thank you for your help but I'm still no closing to working the problem out.. I don't really know the first thing about Javascript or not to write it.. You said you had done this before. Could you maybe show me an example of how it is done? I wouldn't ask but I'm on a deadline.
  2. I feel sooo stupid asking this but I can't work out why my scripts not working right. $to = $email; $subject = "Foto-junkies Registation"; $body = "Dear $first_name $surname <br /> Welcome to Foto-Junkies.co.uk <br /> Username:$username"; $headers = "From: Foto-junkies"; mail($to, $subject , $body, $headers); This works fine, send an e-mail to where I want it to. But the html doesn't work it's printing out the tags as they are in the script instead of converting them. My first thought was that my inbox didn't allow html in e-mails for some reason but I checked and thats all fine. Anyone have any idea what I'm doing wrong?
  3. Thanks that was useful but not exactly what I'm looking for. I will try explaining again.. basically I wanna pass two bits if information(two variables). So the information in the input field would be one and these and there will be a second bit of information say the name of the field or something. From a html form to a php script using Ajax. Does that make sense? Sorry I'm really bad at explaining stuff.
  4. How come loads of people are looking at my question but no ones replying? Does what I have written not make since? Is it so easy that you are all just laughing at me? =P
  5. Ever since I started web development I have avoided learning Javascript, probably not the best idea cos now I need to use some. Basically what I want to do is pass two vars from a html form to a php script using Ajax I found out how to pass one no problem but I can't get my head around how I would pass another. It's probably really simple! Here is the html code I'm using and the Ajax file. <script src="clienthint.js"></script> <form action="userinput.php" method="post"> <p><label for="txt1">Username:</label><input type="text" id="txt1" name='username' onkeyup="showHint(this.value)"><span id="txtHint"></span></p> var xmlHttp function showHint(str) { if (str.length==0) { document.getElementById("txtHint").innerHTML=""; return; } xmlHttp=GetXmlHttpObject(); if (xmlHttp==null) { alert ("Your browser does not support AJAX!"); return; } var url="gethint.php"; url=url+"?q="+str; url=url+"&sid="+Math.random(); xmlHttp.onreadystatechange=stateChanged; xmlHttp.open("GET",url,true); xmlHttp.send(null); } function stateChanged() { if (xmlHttp.readyState==4) { document.getElementById("txtHint").innerHTML=xmlHttp.responseText; } } function GetXmlHttpObject() { var xmlHttp=null; try { // Firefox, Opera 8.0+, Safari xmlHttp=new XMLHttpRequest(); } catch (e) { // Internet Explorer try { xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); } } return xmlHttp; }
  6. Think I've fixed it that you for all your help
  7. Warning: mkdir() expects at most 2 parameters, 3 given in /home2/amytucke/public_html/site/php/album/createalbum.php on line 78
  8. Thanks I will try the absolute pathnames! Not sure what you mean when you say I'm trying to create 2 dirs but I will check the manual. uhmm I wasn't aware that the script I was using needed special permissions what would they be? 777?
  9. I'm having problems when creating files using a php script. The file is created fine but the chmod is not working even though I have set it to 0777 it's been set to 0755. mkdir("../../images/photos/$user_id/$filename1/", 0777); I really can't work out why this line of code is not working other than it being a problem with the server I'm using.
  10. I've found a great GB lib which lets me easily and quickly create graphs using PHP but I can't seem to incorporate the graphs into a html page when I try I get the following error. Does anyone know a way I can get around this?
  11. The first loop finds the $total I need this before I can do the math in the second loop.
  12. I'm trying to do this.. $poll_id_query = mysql_query("SELECT * FROM tblPollQuestions WHERE username = '$user' ORDER BY pollID DESC LIMIT 1 "); $poll_id_array = mysql_fetch_array($poll_id_query); $poll_id = $poll_id_array['pollID']; $poll_question = $poll_id_array['question']; echo "<p>$poll_question</p><br /><p>"; $poll_query = mysql_query("SELECT * FROM tblPollAnswers1 WHERE pollID = '$poll_id' "); while ($poll_array = mysql_fetch_array($poll_query)){ $amount = $poll_array['amount']; $total = $total + $amount; } while ($poll_array = mysql_fetch_array($poll_query)){ $answer = $poll_array['answer']; $amount = $poll_array['amount']; $amount = round((($amount * 100) / $total),1); echo "$answer - <img src='sections/line.jpg' width='14%' height='5'><br />"; } But the second loop doesn't run cos the first one is there.. anyone have any idea what I can do instead? I'm probably coding this really stupidly but it's really late at night and I can't think. Thanks for any help.
  13. When I started writing this script it sounded pretty simple but I've run into a few problems. The script some information from a database and then a loop is used to put the information into variables. What I want is for each time the loop is run it outputs different variables so that these variables can then be used later on in the script. So for example at the moment each time it goes around a different value is assigned to $data1 etc but I want it to create a new variable to put the data into instead of just writing over the old one. $querydata = "SELECT * FROM tblgraphdata WHERE graphID ='1'"; $resultsdata = mysql_query($querydata) or die ("Problem with query:" . mysql_error()); $rowsdata = mysql_num_rows($resultsdata); $i = 0; while ($i < $rowsdata){ $data1 = mysql_result($resultsdata, $i, "data1"); $data2 = mysql_result($resultsdata, $i, "data2"); $data3 = mysql_result($resultsdata, $i, "data3"); $data4 = mysql_result($resultsdata, $i, "data4"); $color = mysql_result($resultsdata, $i, "color"); $i ++; } Any ideas? Thank you soo much for helping!
  14. Hi I'm trying to create a news section for a website.. I've hit a problem though. On the main news page I want only the first part of the news item to be shown and then a link to the full story. Does anyone know how I can achieve this? (I'm not exactly a wiz with this stuff) Thanks for any help!
  15. I'm having an problem with using the following line on my website "header("Location: viewphotos1.php");" I need this line to be called half way down the page (after html ect) I know this doesn't work so I create a function: function goto() { header("Location: viewphotos1.php"); } And stuck this at the top of the page under my session_start(); line. Later on down the page if a users login information is correct they should be sent back to viewphotos1.php however I'm getting an error message. Warning: Cannot modify header information - headers already sent by (output started at /home2/amytucke/public_html/site/inc/header.php:14) in /home2/amytucke/public_html/site/login.php on line 6 Does anyone know a way around this? I figured using a function would work but I guess not.
  16. flyersun

    Help!

    Hi I've come accross a problem with a script which I'm really having trouble with.... It's really hard to explain so I will try and give an example of what I wanna do. Say you had a page with a shout box in and the shoutbox was a diffrent script which was an include within the page.. now when you subit a post to the shout box the form send the information back to the script and the shoutbox script is loaded in the brower.. you lose the rest of your page.... thats my problem.... I would be eternaly greaful for any help on this matter!
  17. I asked about this a while ago didn't really get anywhere with the project. Now I've working on it again I've pretty much got the whole thin worked out in my head I only have one problem which I'm hoping to get some help with. Here's the problem. The site is a quotation system for a travel insurance company. I need the information on the form to change depending on what sort of trip is selected from a drop down menu. I know this is done using the on select java script fuction.. but I don't know where to go from there. I would normaly just go find the js on the web but I'm not even really sure what I'm looking for.
  18. Thanks! that make it alot clearer! Amy
  19. function showCart() {   //connection to database   global $db;   // Get info from the session var and stuff it in $cart   $cart = $_SESSION['cart'];   //check if there is anything in $cart   if ($cart) {       //If there is something in $cart put it in an array called $items (brake part where there are ,'s)       $items = explode(',',$cart);       //create an array called $contents       $contents = array();       //Loop, go though the $items array untill there are no more items left       foreach ($items as $item) { // This is where I start to get confused it's checking if there is anything in $contents[$item] and         //then putting what ever's there into putting it back in it's self?  I don't have a clue what the question mark does.         // but then it seems to be adding 1 to the value and not sure what the last bit does.. hmm         $contents[$item] = (isset($contents[$item])) ? $contents[$item] + 1 : 1;       }
  20. ok you have a point.. how about I tell you what I think it means and you tell me if I'm close or not?
  21. As part of my assignment I have to explain what all the code I've used does... thats all well and good but I have this code which my tutor wrote and I'm a bit at at loss to work how it works. This is part of a shoping cart script I know what it does but I'm not to sure how.. can anyone help please? function showCart() { global $db; $cart = $_SESSION['cart']; if ($cart) { $items = explode(',',$cart); $contents = array(); foreach ($items as $item) { $contents[$item] = (isset($contents[$item])) ? $contents[$item] + 1 : 1; } $output[] = '<form action="cart.php?action=update" method="post" id="cart">'; $output[] = '<table>'; foreach ($contents as $id=>$qty) { $sql = 'SELECT * FROM cds WHERE cdID = '.$id; $result = $db->query($sql); $row = $result->fetch(); extract($row); $output[] = '<tr>'; $output[] = '<td><a href="cart.php?action=delete&id='.$id.'" class="r">Remove</a></td>'; $output[] = '<td>'.$title.' by '.$artist.'</td>'; $output[] = '<td>&pound;'.$price.'</td>'; $output[] = '<td><input type="text" name="qty'.$id.'" value="'.$qty.'" size="3" maxlength="3" /></td>'; $output[] = '<td>&pound;'.($price * $qty).'</td>'; $total += $price * $qty; $output[] = '</tr>'; } $output[] = '</table>'; $output[] = '<p>Grand total: <strong>&pound;'.$total.'</strong></p>'; $output[] = '<div><button type="submit">Update cart</button></div>'; $output[] = '</form>'; } else { $output[] = '<p>You shopping cart is empty.</p>'; } return join('',$output);
  22. Well I was using my address to text it but I would rather not post it here so I will just give an example of the sort of thing I'm tring to enter. 110 new street
  23. I've created an input form and a validation script. Within the validation script I'm using alot of reg expressions most of these work but I'm having problems with two of them. When I input a address like which contains numbers, letters and spaces I get an error message even though this string should allow them. Anyone have any ideas why? //Validate the address if (eregi ('^[[:alpha:]][0-9][[:blank:]]{2,40}$', stripslashes($_POST['address']))){ $address = $_POST['address']; }else{ //A correct address has not been entered $errorString .= "Please enter your address<br>\n"; }
×
×
  • 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.