Jump to content

Giri J

Members
  • Posts

    20
  • Joined

  • Last visited

    Never

Everything posted by Giri J

  1. Guys, Anyone tried moving a forum from ccBoard to phpBB ? Any help would be greatly appreciated. Thanks a lot in advance.
  2. Hi, this is a simple thing I used. If the user is inactive 10 mins I will log him out. <?php $_session['timein']=time(); $maxTime = 600; // this is 10 mins in secs. $tot_time = time() - $_session['timein']; if($tot_time > $maxTime) { session_destroy(); header("Location: logout.php"); } ?> I check this on every page. This might now be the exact code but I've just put whatever is on my mind. hope it makes sense. Cheers
  3. Brilliant Calver... this works .... Thanks a lot for the help .... :)
  4. I forgot one thing sorry. It works with datatype "datetime"
  5. Hi I usually update the date using now() function like this $qrydate = mysql_query("INSERT INTO table (date) VALUES (now()) WHERE id = $id"); now() is a mysql function. when u execute the query it will automatically updates the date and time. By the way can we use a where clause in insert ?? Please lemme know. thanks
  6. Hello All, I have a problem with my update query. The insert query works fine with all the values. But when I use the update query it throws me error. I'm stuck. please help. Here is my update query in php $q1="update vehicle SET vdesc='$vDesc',SET vimg='$vImg1',SET user='$uid',SET log=now() where vname='$vName'"; Here are my values (retrieved from form): $vDesc=This is my vehicle test $vImg1=1.jpg $uid=test $vName=My Car Model 000T Here is the error message: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SET vimg='1.jpg',SET user='test',SET log=now() where vname='My Car Model 000' at line 1 Please help... Thanks a lot in advance.
  7. Hi, You mean to say I have to request the support guys to configure smtp in php config to some gmail servers or something? Please let me know. thank you
  8. Hi, I'm not sure if it works for you. But try echoing the html a tags and just use 1 php close and open. eg: <?php ...some code if (true) echo "<a href=\"true.html\"">True</a>"; else echo "<a href=\"false.html\"">False</a>"; ...some php code ?>
  9. Hello Guys, I'm trying out on the mail function. I've created my website and added a contact form. Now I want the contact details to come to my gmail id. I've written the following code. ---------------------------------------------------------------------------------------- <?php $to = "[email protected]"; $subject = "Test My Code"; $name_field = $_POST['cName']; $email_field = $_POST['cEmail']; $from = "Contact Form"; $message = $_POST['comments']; $ph=$_POST['cPh']; $cLoc=$_POST['cLoc']; $body = "From: $name_field\n E-Mail: $email_field\n Phone: $ph\n Country: $cLoc\n Message:\n $message"; echo "Data has been submitted to $to!"; mail($to, $subject, $body, "From: $from") ?> ---------------------------------------------------------------------------------------- When I tried the code on my local it threw a error saying some smtp problem. Later I uploaded the same code onto my server. I didn't see any errors but at the same time I didn't receive any data in my gmail inbox. I've tried searching old threads but it didn't help. Did I miss something? I don't know. Please Help. Thanks in Advance.
  10. The following code perfectly works. u ROCK man \m/. tons and tons of thanks to ya and thank you every one for your super fast responses. much much appreciated
  11. Hi guys, That's like a rocket response. Here is my test code. <?php //Connections mysql_connect("localhost", "root", "giri") or die(mysql_error()); mysql_select_db("hexl_data") or die(mysql_error()); //Get Week No. //$wkno=$_POST['wkno']; //Mysql Querys $qry1="select distinct (coder) from daily_reports where week_no=2"; $exeQ1=mysql_query($qry1) or die ("Q1 :: Error ::: ".mysql_error()); $num1=mysql_num_rows($exeQ1); //Result set if($num1<1) { echo "Unable to retreive data. Please try again."; } else { while($rows = mysql_fetch_array($exeQ1, MYSQL_ASSOC)) { echo "Coders:".$rows['Coder']; } } ?> and here are my errors: Notice: Undefined index: Coder in D:\wamp\www\Reports\qau\test.php on line 25 Coders: Notice: Undefined index: Coder in D:\wamp\www\Reports\qau\test.php on line 25 Coders: Notice: Undefined index: Coder in D:\wamp\www\Reports\qau\test.php on line 25 Coders: Notice: Undefined index: Coder in D:\wamp\www\Reports\qau\test.php on line 25 Coders: Let me know if anything is confusing. Cheers G.
  12. Hi, My code is as follows: $qry1="select distinct (coder) from daily_reports where week_no=$wkno"; $exeQ1=mysql_query($qry1) or die ("Q1 :: Error ::: ".mysql_error()); $num1=mysql_num_rows($exeQ1); I need some help / syntax on how to retrieve the results of mysql query (select distinct (coder) from daily_reports where week_no=$wkno) The query is working fine on mysql it retrieves 4 rows. I want to know how to get the results in php. I tried mysql_fetch_array(). I get the following error: Notice: Undefined offset: 1 in D:\wamp\www\Reports\qau\processGU.php on line 27 I tried searching but didn't exactly get the relevant solution. Please post if there are any existing threads. Thank you very much ! Cheers G.
  13. Hi, I'm trying curl. I was successful when I worked it on my laptop. But when I bought the files to office and tried to run the php it gives me a error "couldn't connect to host " What could be the reason and Is there any solution. i'm using wamp 2.0 Thanks in advance Giri.
  14. that's alright It was great you actually took time and replied me. Thank you. Have a good day.
  15. Hi Maq, Thanks a lot for the help. I've just made some experiments based on the change you told and went through the following link http://www.phpfreaks.com/forums/index.php/topic,216783.0.html and finally my problem is solved. now I generate 100 text fields and I'm able to get all the data in one shot thanks PHP Freaks ! If some one out there having some similar problem like mine here is the solution. MY HTML CODE : (Dynamic Form using JS for generating the textfields) <html><head> <title>My Test Page - Giri JS + PHP + Bynamic Form it works</title> <script type="text/javascript"> function addFieldz() { var i = document.getElementById('rows').value; alert ("i val = "+i); while (i > 0) { txtFields.innerHTML = txtFields.innerHTML+"<br><input type=\"text\" name=\"t[]\" id=\"t[]\" \/><br/>"; i--; } } </script></head> <body> <form method="post" action="test-js-php.php"> No. of Text Fields: <input type="text" name="rows" id="rows" style="width:30px;"> <input type="button" onClick="addFieldz()" name="add" id="add" value="Add"> <div id="txtFields"> </div> <br/> <input type="submit" name="submit" id="submit" value="submit"> <input type="reset" name="reset" id="reset" value="reset"> </form> </body></html> MY PHP CODE: <?php $num = $_POST['rows']; //echo "<br/>num val outside - ".$num; while ($num > 0) { //echo "<br/>num val in while - ".$num; echo "<br/>form value: ".$_POST['t'][$num-1]."<br/>"; $num--; } ?> Hope this helps someone. A 100,000 thanks to Maq and 1,000,000,000 thanks to PHP Freaks ! Giri.
  16. Hi I've changed my JS code to what is suggested. So My Js dynamic test field looks like this txtFields.innerHTML = txtFields.innerHTML+"<br><input type=\"text\" name=\"t["+i+"]\" id=\"t["+i+"]\" \/><br/>"; and I've used the code suggested for PHP my php code is like this <?php foreach ($_POST as $key => $value) { echo "<br/>key: " . $key . " <br/>value: " . $value . "<br/>"; ?> This is the output I get key: rows value: 2 key: t value: Array key: submit value: submit aah I'm confused. The " key:t value:Array " are actually the text fields that are dynamically generated. I need the values in that text fields. Is there a way we can retrieve them? I've tried $t[0] but it didn't work. Any help?? Thanks in advance.
  17. Hi Thank you for replying back. As I'm new I'm trying to understand the concept. You mean to say I have to change the following statement from txtFields.innerHTML = txtFields.innerHTML+"<br><input type=\"text\" name=\"t"+i+"\" id=\"t"+i+"\" \/><br/>"; to txtFields.innerHTML = txtFields.innerHTML+"<br><input type=\"text\" name=\"t["+i+"]\" id=\"t["+i+"]\" \/><br/>"; So that I can read it as array in php or something like that? Please let me know. Thanks again Giri
  18. Hi, First thing PHP freaks Rocks. People are helpful, quick, genius and dynamic . Thank you PHP freaks and all the people in here. I'm a beginner in PHP. I have a dynamic form. It generates n no. of text fields at 1 shot. Here is the HTML Code: /// HTML Code Starts here /// <html><head> <title>My Test Page</title> <script type="text/javascript"> function addFieldz() { var i = document.getElementById('rows').value; alert ("i val = "+i); while (i > 0) { txtFields.innerHTML = txtFields.innerHTML+"<br><input type=\"text\" name=\"t"+i+"\" id=\"t"+i+"\" \/><br/>"; i--; } } </script></head> <body> <form method="post" action="test-js-php.php"> No. of Text Fields: <input type="text" name="rows" id="rows" style="width:30px;"> <input type="button" onClick="addFieldz()" name="add" id="add" value="Add"> <div id="txtFields"> </div> <br/> <input type="submit" name="submit" id="submit" value="submit"> <input type="reset" name="reset" id="reset" value="reset"> </form> </body></html> /// HTML Code Ends here /// So Initally I wanted to test it for 3 text fields. Here is my PHP code. <?php $val1 = $_POST['t1']; $val2 = $_POST['t2']; $val3 = $_POST['t3']; echo $val1.$val2.$val3; ?> This works. I was really happy by this achievement. But now comes the real problem. How can I retrieve the values if there 100 text fields ?? . Is there a way in php, so we can get the post values in a loop by some conditions?? Please help. Thanks in Advance.
  19. Thanks a lot mate. It solved my problem :) I'm successfully able to get the data from the dynamically generated text fields Much Appreciated. One final request: is there a site where we can quickly brush up JS skills with some good examples? Please let me know.
  20. Hi, I have a html + javascript code like this : <html> <head> <title>Dynamic Form test pge</title> <script language="javascript"> function changeIt() { var i = 1; my_div.innerHTML = my_div.innerHTML +"<br><input type='text' name='mytext'+ i><br/>" } </script> </head> <body> <form action="test-js-php.php" method="post"> <input type="button" value="test" onClick="changeIt()"> <input type="submit" value="submit"> <div id="my_div"> </div> </body> If you save this as a html file and click on test button it will keep adding the text fields. Now, This is my problem: > I want to enter some data into those text fields > and When I submit it I want the data from the HTML form to my PHP. My php code is like this: <?php $t1=$_POST['mytext1']; $t2=$_POST['mytext2']; $t3=$_POST['mytext3']; echo $t1.$t2.$t3; ?> Please help me. I'm not that good at Javascript.
×
×
  • 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.