Jump to content

bindiya

Members
  • Posts

    97
  • Joined

  • Last visited

    Never

Everything posted by bindiya

  1. I am bit confused. Can we display the latest tweet in the webpage.
  2. I had a folder(folder1) for blog which contained php files, js and html files in my server. Now I have created a new folder(folder2) to place all this pages said above in folder1. I have placed or copied all my files of folder1 to folder2 and in folder1 i have files which says redirect to folder2. It was possible for php and html files. But how can i write a file to redirect the js files or is it not needed?
  3. i tried to give the full sites name, but then i got the error message cannot give full path address to the move_uploaded_file() that is the worrying matter......
  4. I am making more clear abvout the above doubt. The image upload is done by the admin. and the admin is able to upload images to the admin/images folder .But admin wants the images to be uploaded to the www.abc.html/images folder. Posting the code again $target = "pics/"; [color=red]//this is created in the admin folder, i need to change here that is keep the folder outside the admin folde[/color]r $target = $target . basename( $_FILES['photo']['name']); $pic=($_FILES['photo']['name']); $image=$pic; $box_num =$_POST['box_num']; $query11 = "update photo_table set page_head='$page_head',image='$image' where id='$box_num'"; $result11 = mysql_query($query11); if(move_uploaded_file($_FILES['photo']['tmp_name'], $target)) { echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded, and your information has been added to the directory"; } }else { echo "Sorry, there was a problem uploading your file."; } } } Any idea?? I just made my doubt so simple, please dont consider this as a re posting.
  5. This topic was pasted in php forum becoz i didnt know this comes in ajax also. When i got the reply to post in ajax forum, i am posting my problem in ajax forum.Sorry for the double post. SORRY. In my php page ,the 5 datas are taken from the database table. 3 among them are displayed in a radio button value,and one is displayed as a value in the input field of type hidden . I need to pass these hidden value along with the selected radio button value to the ajax script Is it possible to do this $q="select * from questions where id=(select max(id) from questions)"; $r=mysql_query($q); $row=mysql_fetch_row($r); $poll_id = $row['id']; $question=$row['question']; [color=red]echo "<input type='hidden' name='question' id='question' value=$question>";[/color]//this value is the one to be passed to ajax function echo "<tr><td>$row[1]</td></tr>". "<tr><td><input type='radio' value='1' name='answer' id='answer' onclick='getVote(this.value)'>$row[2]</td></tr>". "<tr><td><input type='radio' value='2' name='answer' id='answer' onclick='getVote(this.value)'>$row[3]</td></tr>". "<tr><td><input type='radio' value='3' name='answer' id='answer' onclick='getVote(this.value)'>$row[4]</td></tr>". "<tr><td><input type='radio' value='4' name='answer' id='answer' onclick='getVote(this.value)'>$row[5]</td></tr>". "</table>"; ------------ajax function function getVote(int) { var quest= document.getElementById['question'].value ; //alert(quest); var params = "vote=int&q=quest"; if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5& +"&question="+q xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("poll").innerHTML=xmlhttp.responseText; } } xmlhttp.open("GET","abc.php? "+params,true); xmlhttp.send(); }
  6. I have a php poll page where the users need to cast their votes and the resut will be showed in a pie chart The questions and are taken from the database table poll_questions When the user cast his vote ,the vote for which answer along with the question should go to the database table poll_votes. I am using ajax for this. I am able to insert the vote to the database. but not able to insert the question to the database. Pasting my code here poll_contest.php <?php include ('config.php'); ?> <html><head> <script type="text/javascript"> function getVote(int) { if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5& +"&question="+q xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("poll").innerHTML=xmlhttp.responseText; } } var url="poll_vote.php"; url=url+"?vote="+int; //url=url+"&sid="+Math.random(); //var url="poll_vote.php?vote="+int+"&question="+q ; +"&question="+q //alert(q); xmlhttp.open("GET","poll_vote.php?vote="+int,true); xmlhttp.send(); } </script> </head> <body> <div id="poll"> <?php $ip=$_SERVER['REMOTE_ADDR']; echo "<table>"; $q="select * from polls_questions where id=(select max(id) from polls_questions)"; $r=mysql_query($q); $row=mysql_fetch_row($r); $poll_id = $row['id']; $question=$row['question']; echo "<input type='hidden' name='question' id='question' value=$question>"; echo "<tr><td>$row[1]</td></tr>". "<tr><td><input type='radio' value='1' name='answer' id='answer' onclick='getVote(this.value)'>$row[2]</td></tr>". "<tr><td><input type='radio' value='2' name='answer' id='answer' onclick='getVote(this.value)'>$row[3]</td></tr>". "<tr><td><input type='radio' value='3' name='answer' id='answer' onclick='getVote(this.value)'>$row[4]</td></tr>". "<tr><td><input type='radio' value='4' name='answer' id='answer' onclick='getVote(this.value)'>$row[5]</td></tr>". "</table>"; ?> </body> </html> poll_vote.php <?php include ('config.php'); $ip=$_SERVER['REMOTE_ADDR']; echo $ip; $vote = $_GET['vote']; $question=$_GET['question']; echo $vote; echo "<br>".$question; ?>
  7. I have a php website with two parts the client part and an admin part in the client part or the viewers end , i need to show the details of products with description and an image (in the front page). The details are entered though the admin part. My problem is the image uploaded goes to the folder in the admin folder but in the home page the images are taken from the images folder suitated in outside the admin folder . How can i upload images or photos to the folder outside the admin though the admin pages. Pasting my code here $target = "pics/"; [color=red]//this is created in the admin folder, i need to change here that is keep the folder outside the admin folde[/color]r $target = $target . basename( $_FILES['photo']['name']); $pic=($_FILES['photo']['name']); $image=$pic; $box_num =$_POST['box_num']; $query11 = "update photo_table set page_head='$page_head',image='$image' where id='$box_num'"; $result11 = mysql_query($query11); if(move_uploaded_file($_FILES['photo']['tmp_name'], $target)) { echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded, and your information has been added to the directory"; } }else { echo "Sorry, there was a problem uploading your file."; } } }
  8. have someone got any ans for this ????????
  9. I have a php page where i need to list all item in a particular month.But the format for date stored is MMMM DD,yyyy that January 22, 2011. How do i extract the month name only from the above format
  10. still the problem is there i have changed the code a lot. Now in invalid message gets printed in the input box but the success message doesnot print. can anyone help mail.php $query1="select count(*) from newsletter_emails"; $c=mysql_query($query1); $old_count=mysql_num_rows($c); $email = $_GET['email'];$date_time = date('Y-m-d'); if (preg_match('/^[^0-9][a-zA-Z0-9_]+([.][a-zA-Z0-9_]+)*[@][a-zA-Z0-9_]+([.][a-zA-Z0-9_]+)*[.][a-zA-Z]{2,4}$/',$email)) { $query="insert into newsletter_emails(email_id,date_subscribed) values('$email','$date_time')"; $email1=mysql_query($query); echo "OK"; } else{ echo "INVALID E-MAIL"; } ==========html <script> var xmlHTTP; function sendmail(email) { if(window.XMLHttpRequest) { xmlHTTP = new XMLHttpRequest(); } else if(window.ActiveXObject) { xmlHTTP = new ActiveXObject("Microsoft.XMLHTTP"); } if(xmlHTTP==null) { alert("Sorry You Browser No Supports XMLHTTP"); return; } var url; url = "email_subscription11.php?email="+email; //alert(url); xmlHTTP.onreadystatechange=state; xmlHTTP.open("GET",url,true); xmlHTTP.send(null); } function state() { if(xmlHTTP.readyState==4) { alert (xmlHTTP.responseText); document.getElementById("email_id").value = xmlHTTP.responseText;//alert (xmlHTTP.responseText); } } </script> <script type="text/javascript"> function send() { var email = document.getElementById("email_id").value; //alert(email); sendmail(email); } </script> <script language="javascript"> function verify_email(){ var email=document.getElementById('email_id').value; //alert(email); var filter = /^([a-zA-Z0-9_ \.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/; if(email == '') { alert("Enter email for subscribing newsletter."); document.getElementById('email_id').value=''; document.getElementById("email_id").focus(); return false; } else if (!filter.test(email)) { alert('Incorrect email address'); document.getElementById('email_id').value=''; document.getElementById('email_id').focus(); return false; } else return true; } </script> <form name='email_subscription' id='email_subscription' action='' method='get' onsubmit="return verify_email();" > <table width="178" align="right"> <tr><td width="108" style="text-align:right"><input type='text' id='email_id' name='email_id' size="18" value="Your Email" style ="COLOR: #999999;" onclick="change_value(this);" /></td><td width="72"><input type='submit' value='Sign Up' name='subscribe' id='subscribe' onClick="send();" /></td></tr> </table></form> but still the success message "OK" is not displayed in the input box"email_id"
  11. I have an html form for subscribing to newsletter. I use ajax and php for (1)accepting the value and (2) submitting to the database and (3) printing the success messsage back. I use a <div> to print the success message. but the client need the message to be printed in the input box where i used to enter the email. This is not working for me.I am pasting the code below. /*------the ajax and email validation*/ scriptmail.html <script> var xmlHTTP; function sendmail(email) { if(window.XMLHttpRequest) { xmlHTTP = new XMLHttpRequest(); } else if(window.ActiveXObject) { xmlHTTP = new ActiveXObject("Microsoft.XMLHTTP"); } if(xmlHTTP==null) { alert("Sorry You Browser No Supports XMLHTTP"); return; } var url; url = "mail.php?email="+email; xmlHTTP.onreadystatechange=state; xmlHTTP.open("GET",url,true); xmlHTTP.send(null); } function state() { var Message = document.getElementById('div_msg'); var str; if(xmlHTTP.readyState==4) { str = xmlHTTP.responseText; } else { str = ""; } Message.className = 'divclass'; Message.innerHTML = str; } <!-- end mail.js file --></script> <script type="text/javascript"> function send() { var email = document.getElementById("email_id").value; //alert(email); sendmail(email); } </script> <script language="javascript"> function verify_email(){//email_subscription var email=document.getElementById("email_id").value; var filter = /^([a-zA-Z0-9_ \.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/; if(email == '') { alert("Enter email for subscribing newsletter,Thanks."); document.getElementById('email_id').value=''; document.getElementById("email_id").focus(); return false; } else if (!filter.test(email)) { alert('Incorrect email address'); document.getElementById('email_id').value=''; document.getElementById('email_id').focus(); return false; } else return true; } </script> <style type="text/css"> <!--//#FF0000; .divclass { font-family: Arial, Helvetica, sans-serif; font-size: 12px; font-weight: bold; color: black; /*background-color: #FFCC00; border: 1px solid #009900;*/ } --> </style> <form name='email_subscription' id='email_subscription' action='' method='get' onsubmit="return verify_email();" > <table bordercolor="#660000" border="1" frame="box" rules="none" > <tr><td colspan='2'><p class="style28"><strong><span class="style22">Subscribe to our Newsletter</a></span></strong></p></td></tr> <tr><td colspan="2" ><div id="div_msg"></div></td></tr> <tr><td width="42"><p class="rvts16 style4 style14"> Email</p></td><td width="212"><input type='text' id='email_id' name='email_id' size="25" /></td> </tr> <tr> <td height="18" colspan="2" style='text-align:right'><button type="button" id="btnEmail" onClick="send();">Send Email</button><!--<input type='submit' value=Subscribe name='subscribe' id='subscribe' onclick="send();"/>--></td></tr> </table></form> /*--the php part*/ mail.php <?php include('config.php'); if(isset($_GET['email'])) { $email = $_GET['email']; $date_time = date('Y-m-d'); $query="insert into newsletter_emails(email_id,date_subscribed) values('$email','$date_time')"; $email=mysql_query($query); if($email) { echo "Your email sent successfully"; } else { echo "Error sending email"; } } else { echo "Please fill all fields"; } ?>
  12. I have a html page where the email subscription is done. The partial php page does the processing of the fields and insert the value to the database. If success,a popup window comes with a sucessmessage and html page should be displayed. But this pop up window does not appear. Pasting my code subscribe.html <html><body> <form name='email_subscription' id='email_subscription' action='email_subscription.php' method='post' onsubmit="return verify_email();" > <table width="312" bordercolor="#660000" border="1" rules="none"> <tr><td colspan='2'><p class="style28"><strong><span class="style22">Subscribe to our Newsletter</span></strong></p></td></tr> <tr><td width="64"><p class="rvts16 style4 style14"> Email</p></td><td width="239"><input type='text' id='email_id' name='email_id' size="35" /></td></tr> <tr><td colspan="2" style='text-align:right'><input type='submit' value=Subscribe name='subscribe' id='subscribe' onsubmit="return verify_email();" /></td></table></form></body></html> email_subscription.php <?php include('config.php'); if(isset($_POST['subscribe'])) { $email=$_POST['email_id']; $date_time = date('Y-m-d'); $query="insert into newsletter_emails(email_id,date_subscribed) values('$email','$date_time')"; $result=mysql_query($query); ?> <script language="javascript"> window.open('SuccessMessage.php?fullview=Y','','height=300,width=525,resizable=yes,scrollbars=yes');</script> <script> window.location='index.html'</script> <?php } ?> SuccessMessage.php <?php echo "<h3><p></p><p></p><p></p><p></p><font color=#660000 ><center> Congratulations! You successfully registered for the newsletter.</center></h3>"; ?> What will be the problem in this code.
  13. Database table post_head varchar(50),date_posted date,post_category varchar(100),description longtext.
  14. I have a div which shows and hide when clicking on More and Less button. I have a pagination code in php written in this div.So when i click next button the next page come but the div will be close.How can i make this div opened when i go to the next page. <script type="text/javascript"> function toggle_fulltxt(id) { var v = document.getElementById('fulltxt'+id).style.display; var morelnk; var lesslnk; if (v=='none') { v='inline'; morelnk='none'; lesslnk='block'; } else { v='none'; morelnk='inline'; lesslnk='none'; } document.getElementById('fulltxt'+id).style.display = v; document.getElementById('fulltxtlnk'+id).style.display = morelnk; document.getElementById('lesstxtlnk'+id).style.display = lesslnk; return false; } </script> <script> function divs_style(){ document.getElementById('fulltxt001').style.display="inline"; } </script> <div id="fulltxtlnk001" style="display:inline">... <a href="" onClick="return toggle_fulltxt('001')" onMouseOver="window.status='Show full description'; return true;" onMouseOut="window.status=''; return true"><span class="style28">LISTS OF HOTELS</span> ></a></div> <div id="fulltxt001" style="display:none"> <?php //Next page: $next_page = $page + 1; if($next_page <= $total_pages) { echo('<a [color=red]onclick="divs_style();"[/color] href='.$pagename.'?limit='.$limit.'&page='.$next_page.'&emir='.$emi.' ><b>Next</b></a> > >'); } ?></p> </div><div id="lesstxtlnk001" style="display:none"><a href="" onClick="return toggle_fulltxt('001')" onMouseOver="window.status='Hide full description'; return true;" onMouseOut="window.status=''; return true">< Less</a></div>
  15. All this is done thru the admin part, there I have multiple checkboxes by which I can select the categories. It is working fine,no issues there. But when it is displayed in the front end, the problm comes
  16. $post_cat=$_GET['category']; $var=$blog_cat; $q1="select * from post_pages where post_category like \"%$var%\" order by posted_date desc "; $q = mysql_query($q1); if(!$q) die(mysql_error()); $no_row = mysql_num_rows($q); if($no_row == 0){echo "<div name='searched' id='searched'><h4>Results</h4>"; echo "<p class='style26' sizcache='3' sizset='44'>Sorry, your search: "" . $var . "" returned zero results</p></div>"; } else{ while($row = mysql_fetch_array($q)) { if($row['category']=='News'){ $c='<a href="category_disp.php?category=news">News</a>'; } if($row['category']=='Issues'){ $c='<a href="category_disp.php?category=issues">Issues</a>'; } echo "<tr><td><p >$row['post_heading']</p><br></td></tr>"; echo "<tr><td> <div >". "<p><span>$row['posted_date']</span> <span>". "<a href='$row[category]' >$row['category']|<a href='$row[comments]'> Post Comments</a></span></p>". "<p> </p></div><br></td></tr>"; echo "<tr><td><p >$row['Posted_By']</p><br></td></tr>"; echo "<tr><td><p ><a href='$row['link_of_post']' >Click Here to read more...</a></p></td></tr>"; echo "</div></td></tr>"; } echo" </table>
  17. I am sorry for not editing the code before post i am posting the code correctly. while($row = mysql_fetch_array($q)) { if($row['category']=='News'){ $c='<a href="category_disp.php?category=news">News</a>'; } if($row['category']=='Issues'){ $c='<a href="category_disp.php?category=issues">Issues</a>'; } echo "<tr><td><p >$row['post_heading']</p><br></td></tr>"; echo "<tr><td> <div >". "<p><span>$row['posted_date']</span> <span>". "<a href='$row[category]' >$row['category']|<a href='$row[comments]'> Post Comments</a></span></p>". "<p> </p></div><br></td></tr>"; echo "<tr><td><p >$row['Posted_By']</p><br></td></tr>"; echo "<tr><td><p ><a href='$row['link_of_post']' >Click Here to read more...</a></p></td></tr>"; echo "</div></td></tr>"; } echo" </table> for example; when i clicked on category News I got many posts which belong to News category.But some among these displayed posts belong to other category also. That is on post can belong to many categories. While displaying the format is Post Heading Date Posted----in Category ----Post comments Description The 'Category' highlighted here contain one,two or more categories in to which the topic is belongs For eg the category in the below example are News and issue. Global Warming Posted on March 11,2011 in News, Issue -----------description of global warming goes here. So when i click on News , the page should display topics that come under News category.To get that I should give the link like <a href="category_disp.php?category=news">News</a>; where category_disp.php is the page where the action takes place. Same way for Issue category , i should provide the link <a href="category_disp.php?category=issues">Issues</a>; This works fine when there is only one category. When the category increases, i am not able to give the links.
  18. I have a php page where I have posts about different topic. I have a menu listing all this categories of topics . Some topics may belong to more than one category. So when i click on a particular menu item, the topic belonging to that category will be displayed. While displaying it is in this format---Topic Heading,Belongs to which all categories,date posted and the description. All this are taken from database. Now my actual issue is I am not able to give links to the categories dispalyed ,if the category exceeds more than 1. For eg: Global Warming Posted on March 11,2011 in News, Issue -----------description of global warming goes here. In the above eg: News and issue are the two categories,when i click on News it should display all the items in news category,and when i click on issue it should display all items of issue category. But I am not able to give this link to the categories. while($row = mysql_fetch_array($q)) { if($row[6]=='News'){ $c='<a href="category_disp.php?category=news">News</a>'; } if($row[6]=='Issues'){ $c='<a href="category_disp.php?category=issues">Issues</a>'; } echo "<tr><td><p >$row[1]</p><br></td></tr>"; echo "<tr><td> <div >". "<p><span>$row[4]</span> <span>". "<a href='$row[6]' >$row[6]|<a href='$row[5]'> Post Comments</a></span></p>". "<p> </p></div><br></td></tr>"; echo "<tr><td><p >$row[2]</p><br></td></tr>"; echo "<tr><td><p ><a href='$row[3]' >Click Here to read more...</a></p></td></tr>"; echo "</div></td></tr>"; } echo" </table>
  19. i am having a index page which shows all the students details on load. In a box i have a refine search textbox,where the user can enter the students name and it does an autocompletion using ajax and php. I get the result also, but the datas which where showing at the time of page load is not hiding or replace by the search result,How can i do this hiding or replacing of the old datas by this search results,when the user does a refine search pasting the code below index.php <style type="text/css"> #results{border:solid 1px #DEDEDE;background:#fff;display:none;} #results ul, #results li{padding:0; margin:0; border:0; list-style:none;} #results li {border-top:solid 1px #DEDEDE;} #results li a{display:block; padding:4px; text-decoration:none; color:#000000; font-weight:bold;} #results li a small{display:block; text-decoration:none; color:#999999; font-weight:normal;} #results li a:hover{background:#FFFFCC;} #results ul {padding:6px;} </style> <script type="text/javascript"> function createObject() { var request_type; var browser = navigator.appName; if(browser == "Microsoft Internet Explorer"){ request_type = new ActiveXObject("Microsoft.XMLHTTP"); }else{ request_type = new XMLHttpRequest(); } return request_type; } var http = createObject(); /* -------------------------- */ /* SEARCH */ /* -------------------------- */ function autosuggest() { q = document.getElementById('search-q').value; // Set te random number to add to URL request nocache = Math.random(); http.open('get', 'getlocations.php?q='+q+'&nocache = '+nocache); http.onreadystatechange = autosuggestReply; http.send(null); } function autosuggestReply() { if(http.readyState == 4){ var response = http.responseText; e = document.getElementById('results'); if(response!=""){ e.innerHTML=response; e.style.display="block"; } else { e.style.display="none"; } } } function GetValue(loc) { var userSelect = document.getElementById(loc).innerHTML; document.getElementById('search-q').value = userSelect; e = document.getElementById('results'); e.style.display="none"; } </script> <label for="user_location">Location</label> <div style="float:right"> <input type="text" name="user_location" maxlength="100" id="search-q" value="" onkeypress="javascript:autosuggest()" /> <div id="results"></div> <div id="results1"></div> </td></tr> </table> </font></p> <p class="style19"><div id="results1"><?php $var = 'ABC'; //$trimmed =addslashes( trim($var)); $trimmed = trim($var); //trim whitespace from the stored variable $pagename ='index.php'; $t1="SELECT * FROM students where name like '$trimmed' order by student_name limit $set_limit , $limit "; $t = mysql_query($t1); if(!$t){ die('Error quering the Database: ' . mysql_error()); } $a = mysql_fetch_object($t); $total_items = $a->cnt; //echo 'Total Number of records in Database: '.$total_items; //echo '<br/>'; $limit= (isset($_GET['limit'])) ? $_GET['limit'] : 20; $page= (isset($_GET['page']))? $_GET['page'] : 1; //echo 'This is Page Number: ' . $page . '<br/>'; //echo 'Current Limit: '. $limit. '<br/>'; if((!$limit) || (is_numeric($limit) == false) || ($limit < 20) || ($limit > 50)) { $limit = 20; //default } //Set defaults if: $page is empty, non numerical, //less than zero, greater than total available if((!$page) || (is_numeric($page) == false) || ($page < 0) || ($page > $total_items)) { $page = 1; //default } //calculate total pages $total_pages =(ceil($total_items / $limit)); $set_limit = ($page * $limit) - $limit; //echo 'Total Pages: '.$total_pages .'<br/>'; $q1="SELECT * FROM students where name like '$trimmed' order by student_name limit $set_limit , $limit "; $q = mysql_query($q1); if(!$q) die(mysql_error()); $no_row = mysql_num_rows($q); if($no_row == 0) die('Dispalyed in page 1;');// No matches met your criteria.'); //Results per page: //echo "limit is".$limit; /*echo('<br/>Records Per Page: <a href='.$pagename.'?limit=10&page=1&emir='.$emi.'> 10</a> | <a href='.$pagename.'?limit=25&page=1&emir='.$emi.'> 25</a> | <a href='.$pagename.'?limit=50&page=1&emir='.$emi.'> 50</a><br/> ');*/ //echo "<div>";/*<table>*/ $count=1; $i=1; while($row = mysql_fetch_array($q)) { //print your data here. if($row[2]==0){ $imgstar=''; } else if($row[2]==1){ $imgstar="<img src='star.gif' alt='*' title=''>"; } else if($row[2]==2){ $imgstar="<img src='star.gif' alt='*' title=''><img src='star.gif' alt='*' title=''>"; } else if($row[2]==3){ $imgstar="<img src='star.gif' alt='*' title=''><img src='star.gif' alt='*' title=''><img src='star.gif' alt='*' title=''>"; } else if($row[2]==4){ $imgstar="<img src='star.gif' alt='*' title=''><img src='star.gif' alt='*' title=''><img src='star.gif' alt='*' title=''><img src='star.gif' alt='*' title=''>"; } else if($row[2]==5){ $imgstar="<img src='star.gif' alt='*' title=''><img src='star.gif' alt='*' title=''><img src='star.gif' alt='*' title=''><img src='star.gif' alt='*' title=''><img src='star.gif' alt='*' title=''>"; } echo"<DIV class=outbox><DIV class=floatLeft><IMG border=0 alt='' src='hleft.jpg'></DIV>"; echo"<DIV class=hTitle>$row[student_name]</DIV><DIV class=floatLeft><IMG border=0 alt='' src='more-detail.jpg'></A></DIV><DIV class=rBar></DIV>"; /*echo"<DIV class=hTitle>$row[student_name]</DIV><DIV class=rBar></DIV>";*/ echo"<DIV class=list><TABLE border=0 cellSpacing=0 cellPadding=2 width='600' align=left ><TBODY> <TR><TD colspan=2 style='COLOR: #996666' vAlign=top noWrap>City:<STRONG> Abu Dhabi</STRONG> Location:<STRONG> $row[3]</STRONG> </TD><TD vAlign=top noWrap align=left> $imgstar </TD> <TD vAlign=top rowSpan=7 ><img width='88' height='88' src=$row[4]> </TD></TR> <TR> <TD style='COLOR: #996666'colSpan=3>$row[student_features]<br><A style='FONT-SIZE: 12px' href='$row[a_link]' class='style26'>$click</A> </TD></TR></TBODY></TABLE></DIV></DIV>"; $i++; } // $count++;$count <DIV class=floatLeft></div> //echo" </div>"; //Results Per Page: Same as earlier one /*echo('<br/>Records Per Page: <a href='.$pagename.'?limit=10&page=1&emir='.$emi.'> 10</a> | <a href='.$pagename.'?limit=25&page=1&emir='.$emi.'> 25</a> | <a href='.$pagename.'?limit=50&page=1&emir='.$emi.'> 50</a><br/> ');*/ //prev. page $prev_page = $page -1; if($prev_page >= 1) { echo('<b><<</b> <a href='.$pagename.'?limit='.$limit.'&page='.$prev_page.'&emir='.$emi.'> <b>Prev.</b></a>'); } //Display middle pages: for($a = 1; $a <= $total_pages; $a++) { if($a == $page) { echo('<b>' .$a.'</b> | '); //no link } else { echo('<a href='.$pagename.'?limit='.$limit.'&page='.$a.'&emir='.$emi.'> '.$a.'</a> | '); } } //Next page: $next_page = $page + 1; if($next_page <= $total_pages) { echo(' <a href='.$pagename.'?limit='.$limit.'&page='.$next_page.'&emir='.$emi.'><b>Next</b></a> > >'); } //} ?> getlocation.php $searchq = strip_tags($_GET['q']); $q1="SELECT * FROM students where name like '$trimmed' order by student_name limit $set_limit , $limit "; $Record = mysql_query($sql); $i=1; if(strlen($searchq)>0){ echo '<ul>'; while ($row = mysql_fetch_array($Record)) {?> <?php echo"<DIV class=outbox><DIV class=floatLeft><IMG border=0 alt='' src='hleft.jpg'></DIV>"; echo"<DIV class=hTitle>$row[student_name]</DIV><DIV class=floatLeft><IMG border=0 alt='' src='more-detail.jpg'></A></DIV><DIV class=rBar></DIV>"; /*echo"<DIV class=hTitle>$row[student_name]</DIV><DIV class=rBar></DIV>";*/ echo"<DIV class=list><TABLE border=0 cellSpacing=0 cellPadding=2 width='600' align=left ><TBODY> <TR><TD colspan=2 style='COLOR: #996666' vAlign=top noWrap>City:<STRONG> Abu Dhabi</STRONG> Location:<STRONG> $row[3]</STRONG> </TD><TD vAlign=top noWrap align=left> $imgstar </TD> <TD vAlign=top rowSpan=7 ><img width='88' height='88' src=$row[4]> </TD></TR> <TR> <TD style='COLOR: #996666'colSpan=3>$row[student_features]<br><A style='FONT-SIZE: 12px' href='$row[a_link]' class='style26'>$click</A> </TD></TR></TBODY></TABLE></DIV></DIV>"; $i++; } echo '</ul>'; } ?> <div class='results1'><?php ?></div>
  20. In my webpage i am using jquery for autocmplete and for displaying the contents in notebook style(notebook template). But only one will work at a time.how to solve the issue
  21. Jquery code help needed,posting here because i was unable to see the jquery code posting area) I have an image scrolling div(div1),which contains thumnails .Above to this i have a div(div2) which shows the enlarged image of the clicked thumbnail with a description of the images on a div(div3) above to the div2. Image enlarging is working fine ,but the description is not showing properly.I need to show the description onhover and also on click of the thumnails. Any help <html><head> <script> $(document).ready(function() { $("#1a").hover(function() { //<img src="+ $(this).attr("alt") +" alt='Large Image' /><br/>"+$(this).attr("rel") $("#galleryoverlay").html("Shahsha boats are made up of local palm trees.Every part of the palm is used for the shasha"); }); $("#2a").hover(function() { $("#galleryoverlay").html("Description goes here gggggg 2!"); }); $("#3a").hover(function() { $("#galleryoverlay").html("Located in the capital "); }); }); $(document).ready(function() { $("#1a").click(function() { $("#galleryoverlay").html(""); $("#galleryoverlay").html("Shahsha boats are made up of local palm trees."); }); $("#2a").click(function() { $("#galleryoverlay").html(""); $("#galleryoverlay").html("My text is changed 2!"); }); $("#3a").click(function() { $("#galleryoverlay").html(""); $("#galleryoverlay").html("Located in the capital "); }); }); }); </SCRIPT></head> <body> <DIV id=galleryTop> <DIV id=galleryoverlay style="background-image:url(gallery_thumb_bg.gif);background-repeat:no-repeat" > <H2 class=green> </H2> <P id=iTitle style=" color:#CCFF00"><strong>Welcome </strong></P> <P style=" color:#FFFFFF"> </P> <P id=iTitle1 style=" color:#FFFFFF">Welcome click the thumbnails to c the description and enlarged photos.</P> <H2 class=green> </H2> </DIV> <DIV id=galleryTopLoader><IMG alt="" src="gallery/012MNv2.jpg"> </DIV> </DIV> <DIV id=galleryBottom> <H2> </H2> <DIV id=galleryNav style="background-color:#CC9999"><A id=leftBtn href="#" style="background-image:url(documents/leftArrow.gif)"><B>Left</B></A> <DIV id=scrollingThumbs class=images> <UL> <LI id='1a'><A id=image20 class=selected title="Shasha Boat" onClick="getImage('20')" href="gallery/012MNv2.jpg" link="gallery/012MN__thumb.jpg"><IMG alt="" src="gallery/012MN__thumb.jpg" ></A> </LI> <LI id='2a'><A id=image9 title=Waterfront onClick="getImage('9')" href="gallery/001TFC_v2.jpg" link="gallery/001TFC__thumb.jpg"><IMG alt="" src="gallery/001TFC__thumb.jpg" ></A> </LI> <LI id='3a'><A id=image17 title="Emirates Palace" onClick="getImage('17')" href="gallery/002TFCv2.jpg" link="gallery/002TFC__thumb.jpg"><IMG alt="" src="gallery/002TFC__thumb.jpg" ></A> </LI> <LI id='4a'><A id=image27 title="Night Life" onClick="getImage('27')" href="gallery/014TFCv2.jpg" link="gallery/014TFC__thumb.jpg"><IMG alt="" src="gallery/014TFC__thumb.jpg" ></A> </LI></ul> </body></html> .
  22. Actually i have a php in which i include another html page.In this html page ,i have photos of all the students(name and id displayed at the bottom of the photo) in an iframe. So in the php page when the html page is loaded,all the pictures of the students will be displayed. Now I want to get the name and id of the student i clicked in the iframe. is there any way to get that. tried with this code function whatever(iframeid,iframefield,target){ mmspobj=document.getElementById(iframeid); if (mmspobj.tagName=='IFRAME'){ myval=window.frames[iframeid].document.getElementById(iframefield).valu e; } document.getElementById(target).value=myval; alert(mmspobj); alert(myval); }
  23. I have a contact form in html with captcha image.The Captcha image is randomnly created using a php file and stored in a session variable. But when i check whether the session (captcha variable) and the use entered captcha value i dont get answer. posting my code below contact.php(html's action page) if(isset($_POST['csubmit'])) { $name=$_POST['cname']; $lname=$_POST['last_name']; $email=$_POST['cemail']; $tele=$_POST['telephone']; $comments=$_POST['comments']; $date_posted=date('Y:m:d H:i:s');$status='Inactive'; $security_code=$_POST['security_code']; //echo $security_code; //echo"<br>". $_SESSION['security_code']; //$_SESSION['security_code'] = $code; //echo $_SESSION['security_code']; //if( $_SESSION['security_code'] == $_POST['security_code'] && !empty($_SESSION['security_code'] ) ) { //if(!(empty($_SESSION['security_code'] ) ||strcmp($_SESSION['security_code'], $_POST['security_code']) != 0)) //if(empty($_SESSION['security_code'] ) || $_POST['security_code']) != 0) //if( $_SESSION['security_code'] == $_POST['security_code'] && !empty($_SESSION['security_code'] ) ) { $sql="insert into contact_us(first_name,last_name,email,contact_number,comments,status,date_posted) values('$name','$lname','$email','$tele','$comments','$status','$date_posted')"; $res=mysql_query($sql); $mail_to_user ="qq@qq.com"; $mail_subject_user="Comments "; $mail_body_user='<table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td colspan="3"> Sir,<br> Please see the comments </td> </tr> <tr> <td width="20%"> </td> <td width="14%"><strong>First Name</strong></td> <td width="66%">'.$_POST[cname].'</td> </tr> <tr> <td> </td> <td><strong>Last Name</strong></td> <td>'.$_POST[last_name].'</td> </tr> <tr> <td> </td> <td><strong>Email</strong></td> <td>'.$_POST[cemail].'</td> </tr> <tr> <td> </td> <td><strong>Telephone Number</strong></td> <td>'.$_POST[telephone].'</td> </tr> <tr> <td> </td> <td><strong>Comments</strong></td> <td>'.$_POST[comments].'</td> </tr> <tr> <td> </td> <td> </td> <td> </td> </tr> </table>'; $headers_user="MIME-Verson:1.0\n"; $headers_user.="Content-Type: text/html;charset=iso-8859-1\n"; $headers_user.="Content-Transfer-Encoding: 8bit\n"; $headers_user.="From: bb@qq.com\n"; $headers_user .="Bcc: aa@gg.com\r\n"; mail($mail_to_user,$mail_subject_user,$mail_body_user,$headers_user); echo "<script language='javascript'>alert('Message has been sent to the Administrator.');</script>"; //=================email to user $mail_to_user1 = $_POST['cemail']; $mail_subject_user1 = "Thanks for contacting with us "; $mail_body_user1 ='<table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td> Sir,<br> We are very much glad to hear from you. We will contact you soon. <br/><br/> Thanks, <br/>Cusrtomer Care</td> <td> </td> <td> </td> </tr> </table>'; $headers_user1="MIME-Verson:1.0\n"; $headers_user1.="Content-Type: text/html;charset=iso-8859-1\n"; $headers_user1.="Content-Transfer-Encoding: 8bit\n"; $headers_user1.="From: aa@qq.com "; mail($mail_to_user1,$mail_subject_user1,$mail_body_user1,$headers_user1); //header('Location:contact_us.html'); echo "<script> self.location='contact_us.html';</script>"; //} /*else{ //Note: the captcha code is compared case insensitively. //if you want case sensitive match, update the check above to // strcmp() //unset($_SESSION['security_code']); echo"<script language='javascript'>alert('The security code you entered is not correct');</script>"; echo "<script> self.location='contact_us.html';</script>"; //header('Location:contact_us.html'); // $errors .= "\n The captcha code does not match!"; }*/ /*else{ ?> <script language="javascript"> alert("The security code you entered is not correct"); history.go(-1); </script> <?php } */ } unset($_SESSION['security_code']); html form=========contact_us.html <form name='contact_form' id='contact_form' method="post" action="contact.php"> <table width="518" height="341" align="center" border="0" style=" vertical-align:top"> <tbody><tr><td width="202" height="28" valign="middle" align="left"> <label for="first_name"><span class="style26 style20">First Name *</span></label> </td> <td width="14" align="center" valign="middle">:</td> <td width="448" valign="top" > <div class="con" ><input type="text" size="30" maxlength="50" name="cname" id="cname" class="contact_text"> </div> </td> </tr> <tr> <td valign='middle'> <label for="last_name"><span class="style26 style20">Last Name *</span></label> </td> <td align="center" valign="middle">:</td> <td valign="top"> <div class="con" > <input type="text" size="30" maxlength="50" name="last_name" id="last_name" class="contact_text"></div> </td> </tr> <tr> <td valign="middle"> <label for="email"><span class="style26 style20">Email Address *</span></label> </td> <td align="center" valign="middle">:</td> <td valign="top"><div class="con" ><input type="text" size="30" maxlength="50" name="cemail" id="cemail" class="contact_text"/></div></td> </tr> <tr> <td valign="middle"> <label for="telephone"><span class="style26 style20">Telephone Number</span></label> </td> <td align="center" valign="middle">:</td> <td valign="top"> <div class="con" > <input type="text" size="30" maxlength="80" name="telephone" id="telephone" class="contact_text" > </div> </td> </tr> <tr> <td height="123" valign="middle"> <label for="comments"><span class="style26 style20">Comments *</span></label> </td> <td align="center" valign="middle">:</td> <td valign="middle"> <div class="cmn_ct"><textarea rows="6" cols="25" maxlength="1000" name="comments" id="comments" onfocus=" this.value = this.value.replace(/\s+/g,'');" onblur="checkLength(this.value,0,100);" class="cmn_text"></textarea></div> </td> </tr> <tr><td><label for="security code"><span class="style26 style20">Security Code *</span></label></td><td align="center" valign="middle"></td><td><img src="CaptchaSecurityImages.php?width=100&height=40&characters=5" alt="security_code" height="22" id="security_code" name='security_code' class='secuimage'/><br /> <div class="se_code"><input id="security_code" name="security_code" type="text" class="secuInput" /></div> <center></td> <tr> <td height="26" colspan="3" style="text-align: center;"> <table width=69% align="right"> <tr><td align='left'> <input type="submit" value="Submit" name="csubmit" onclick="return verify();"> </td></tr></table> </td> </tr></table></form></p> CaptchaSecurityImages.php <?php class CaptchaSecurityImages { var $font = 'monofont.ttf'; function generateCode($characters) { /* list all possible characters, similar looking characters and vowels have been removed */ $possible = '23456789bcdfghjkmnpqrstvwxyz'; $code = ''; $i = 0; while ($i < $characters) { $code .= substr($possible, mt_rand(0, strlen($possible)-1), 1); $i++; } return $code; } function CaptchaSecurityImages($width='120',$height='40',$characters='6') { $code = $this->generateCode($characters); /* font size will be 75% of the image height */ $font_size = $height * 0.75; $image = @imagecreate($width, $height) or die('Cannot initialize new GD image stream'); /* set the colours */ $background_color = imagecolorallocate($image, 255, 255, 255); $text_color = imagecolorallocate($image, 20, 40, 100); $noise_color = imagecolorallocate($image, 100, 120, 180); /* generate random dots in background */ for( $i=0; $i<($width*$height)/3; $i++ ) { imagefilledellipse($image, mt_rand(0,$width), mt_rand(0,$height), 1, 1, $noise_color); } /* generate random lines in background */ for( $i=0; $i<($width*$height)/150; $i++ ) { imageline($image, mt_rand(0,$width), mt_rand(0,$height), mt_rand(0,$width), mt_rand(0,$height), $noise_color); } /* create textbox and add text */ $textbox = imagettfbbox($font_size, 0, $this->font, $code) or die('Error in imagettfbbox function'); $x = ($width - $textbox[4])/2; $y = ($height - $textbox[5])/2; imagettftext($image, $font_size, 0, $x, $y, $text_color, $this->font , $code) or die('Error in imagettftext function'); /* output captcha image to browser */ header('Content-Type: image/jpeg'); imagejpeg($image); imagedestroy($image); $_SESSION['security_code'] = $code; } } $width = isset($_GET['width']) ? $_GET['width'] : '120'; $height = isset($_GET['height']) ? $_GET['height'] : '40'; $characters = isset($_GET['characters']) && $_GET['characters'] > 1 ? $_GET['characters'] : '6'; $captcha = new CaptchaSecurityImages($width,$height,$characters); ?> I just want to know how will i pass a session variable frm php to html thru js and from there to the php page where action of the html page occurs?
×
×
  • 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.