PHP - Php/javascript Unsure
Just a selection of the code that's relevant basically its always showing as over 1 hour, even if its one minute i really cannot see why i want it to countdown to 55 of every hour but instead of being 1 minute for example it will say 61, any ideas from my code below?
Code: [Select] <?php $HourOn = date('G'); $MinuteOn = 55; if($HourOn == $HourOn || $MinuteOn > $MinuteOn){ $HourOn = date('G') + 1; $MinuteOn = 55; } else { $MinuteOn = 55; $HourOn = date('G'); } ?> dateFuture1 = new Date(<?php echo date('Y'); ?>,<?php echo date('m') - 1; ?>,<?php echo date('d'); ?>,<?php echo $HourOn;?>,<?php echo $MinuteOn; ?>,0); Similar TutorialsUnsure is totally me today...user if this is correct thread to ask about my issues... I am creating a social networking site. All going well... I am hit I can’t figuare this out i am sure wether it’s a mouseover or hover... In facebook when you have a married status it shows the link to the person you have selected. When you hover over the link it shows a table with the users cover images, name and message or see friends, ETC I am trying to find a code similar to this but I am unsure what I am looking for to help me. Any help much appreciated So everything works except for the capture of whether or not the checkbox was checked. It works for the "Tour" variable, however I can only get it to work for one of the the other ones. Everything from tour to the end is a checkbox. Any idea on what I'm doing wrong? I think it has to do with "<td>" versus the "<tc>" but I really have no clue. Thanks Code: [Select] while ($row = mysql_fetch_assoc($result)) { echo "<tr>"; echo "<td>".$row['Timestamp']."</td>"; echo "<td>".$row['First_Name']."</td>"; echo "<td>".$row['Last_Name']."</td>"; echo "<td>".$row['Prefer']."</td>"; echo "<td>".$row['Home']."</td>"; echo "<td>".$row['Phone']."</td>"; echo "<td>".$row['Email']."</td>"; echo "<td>".$row['Affiliation']."</td>"; echo "<td>".$row['Hear']."</td>"; echo "<td>".$row['Tour']."</tc>"; echo "<td>".$row['Dday']."</tc>"; echo "<td>".$row['SMS']."</tc>"; echo "<td>".$row['Annual']."</tc>"; echo "<td>".$row['OSS']."</tc>"; //echo "<td>".$row['Class']."</td>"; echo "</tr>"; } //end while ($row = // Free the resources associated with the result set // This is done automatically at the end of the script mysql_free_result($result); }//end if($result) }//end else if(!$db) ?> </form> </table></body></html> Hello Everyone,
I need some advice on how to proceed with my code.
What I am attempting to acheive ...
I am writing an out of stock script, all is working fine except for the one thing,
In my Database table I have numerous product id's (prod_id) from different clients (cus_id)
I would like to write some code that presents to the customer a message when they on on a product page they have marked for notification when back in stock when they are logged in, so the way i see it working is to pad for the cust id, then add all the product id's asscociated with the cust id, then compare it to the prod_id that is being viewed, there is already a page under the account section that shows all items added to the notifications with the options to delete them, but feel this extra bit will top it off.
I have tried many different things, and I think it has to be some kind of loop, but am totally stuck.
Can any of you give me some advice on how to go please?
i had a look on how to do this but it looks too complicated. all i want is to mail a small .txt as an attachment can anyone help please? i have this code: $to = "a mail adress"; $file = "/home/rainbowcode/StatsFile.txt"; $subject = "StatsFile.txt"; $email = "a mail adress"; $message = "Here is your Statsfile; for today"; $headers = "From: $email"; mail($to, $subject, $message, $headers); can anyone help me please? thanks The below is outputting: Array Fatal error: Unsupported operand types in /home/zyquo/public_html/area51entertainment.co/maintenance/home.php on line 28 So clearly $project_row_num is coming out as an array, and the multiplication is failing because its got a string not a number. I just don't see why it's getting an array out of $project_row_num. <?php $num_projects=15; $scroller_projects=""; require_once 'db_select.php'; $project_query_num="SELECT COUNT(*) FROM $tbl_name"; $project_result_num=mysql_query($project_query_num); $project_row_num=mysql_fetch_assoc($project_result_num); echo $project_row_num; //if($project_row_num <= $num_projects){ $project_query="SELECT * FROM $tbl_name"; $project_result=mysql_query($project_query); /*} else{ $project_query="SELECT * FROM $tbl_name WHERE project_release_date BETWEEN $start_date AND $end_date LIMIT 0,$num_projects"; $project_result=mysql_query($project_query); }*/ $i=1; while($project_row=mysql_fetch_array($project_result)){ extract($project_row); $scroller_projects.='<div class="project_entry" tabindex="'.$i.'" onclick="sndReq(\''.$project_id.'\');">Test</div>'; $i++; } if($project_row_num==""){ $films_row_num=$num_projects; } $scroller_width=$project_row_num*114; $content=' <div class="video_scroller_wrapper"> <div class="video" id="tabs"> </div> <div class="recentfilms_wrapper"> <div class="left_arrow"><img src="arrow_left.png" alt="Left" title="" class="arrow_left" onclick="jumpLeft(\'recentfilms\')" onmouseover="startScrollLeft(\'recentfilms\')" onmouseout="stopScroll()" /></div> <div id="recentfilms"> <div id="scroller" style="width: '.$scroller_width.'px;"> '.$scroller_projects.' </div> </div> <div class="right_arrow"><img src="arrow_right.png" alt="Left" title="" class="arrow_right" onclick="jumpRight(\'recentfilms\')" onmouseover="startScrollRight(\'recentfilms\')" onmouseout="stopScroll()" /></div> </div> </div> <div class="news_wrapper"> <div class="news"> <div class="news_title"><span class="category_title_text">Latest News</span></div> <div class="news_text"> <iframe src="http://www.indiegogo.com/project/widget/75876?a=9030" style="width: 224px; height: 429px; position: relative; left: 3px; top: 15px; border: 0px; overflow: hidden;"></iframe> </div> </div> </div> '; ?> Basically, I'm still trying to wrap my head around OOP. What I'm trying to do here is a simple OOP user login script. But when I submit the form, all that happens is that the text fields reset them selves and nothing that I feel should be happening, happens. ie: I submit login data, and either it displays an error or reirects to index page. Neither happen, the form merely resets. Where am I going wrong? Code: [Select] <form name="loginform" id="loginform" action="<?php $_SERVER['PHP_SELF']; ?>" method="post"> <p> <label>Username<br> <input name="user" id="user_login" class="input" size="20" tabindex="10" type="text" /> </label> </p> <p> <label>Password<br> <input name="pass" id="user_pass" class="input" value="" size="20" tabindex="20" type="password"></label> </p> <p class="forgetmenot"><label><input name="rememberme" id="rememberme" value="forever" tabindex="90" type="checkbox"> Remember Me</label></p> <p class="submit"> <input name="login" id="submit" class="button-primary" value="Log In" tabindex="100" type="submit"> <input name="redirect_to" value="/users.php" type="hidden"> </p> </form> Code: [Select] <?php if(isset($_POST['login'])) { $username = $_POST['user']; $password = $_POST['pass']; include("./classes/class.users.php"); USERS::login($username, $password); } ?> Code: [Select] <?php // Yes, my DATABAASE::DoIT(1) // (0) is working as intended (from a different include file) class USERS { var $user; var $pass; var $email; ////////////////////////////////////////////////////////////////////////////////////////////// function login($user, $pass) { include("/var/www/config.php"); DATABASE::DoIt('1'); $hashword = sha1($CONFIG['salt1']."$pass".$CONFIG['salt2']); $sql = "SElECT * FROM users WHERE username='$user' AND hashword='$hashword'"; $result = mysql_query($sql); $count = mysql_num_rows($result); if($count==1) { while ($row = mysql_fetch_assoc($result)) { define('USERS_AUTHENTICATED', true); $_SESSION['USERS_username'] = $row['username']; $_SESSION['USERS_userid'] = $row['userid']; DATABASE::DoIt('0'); header("Location: index.php"); } } else { $_SESSION['loginError'] = true; DATABASE::DoIt('0'); return $_SESSION['loginError']; } DATABASE::DoIt('0'); } } ?> This topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=306863.0 Hi, I've attempted to put together a portfolio on my WP blog using php, jquery, and this tutorial- http://wp.tutsplus.com/tutorials/theme-development/create-a-quicksand-portfolio-with-wordpress/ I've gone to my WP site and tried to put it together, but nothing seems to work. Aside from "what's wrong?" I'd also like to know how do I utilize these features to display my portfolio? (Simply post images in the page/post, set featured images, etc.) My apologies for this perhaps not being the easiest question, but thorough help and advice is greatly appreciated. If further information is needed, please let me know. functions.php <?php // portfolio include("portfolio/portfolio-post-types.php"); // Register our scripts function register_js() { if ( !is_admin() ) { wp_register_script( 'quicksand', get_template_directory_uri() . '/js/jquery.quicksand.js', 'jquery' ); wp_register_script( 'easing', get_template_directory_uri() . '/js/jquery.easing.1.3.js', 'jquery' ); wp_register_script( 'custom', get_template_directory_uri() . '/js/jquery.custom.js', 'jquery', '1.0', true ); wp_enqueue_script( 'jquery' ); wp_enqueue_script( 'quicksand' ); wp_enqueue_script( 'easing' ); wp_enqueue_script( 'custom' ); } } add_action('init', 'register_js'); // Register our styles function register_css() { if (!is_admin()) { wp_register_style( 'prettyPhoto', get_template_directory_uri() . '/css/prettyPhoto.css' ); wp_enqueue_style( 'prettyPhoto' ); } } add_action( 'init', 'register_css' ); // sidebar functions if(function_exists('register_sidebar')) { register_sidebar(); } // add thumbnail support add_theme_support('post-thumbnails'); // disable autoformat with raw function my_formatter($content) { $new_content = ''; $pattern_full = '{(\[raw\].*?\[/raw\])}is'; $pattern_contents = '{\[raw\](.*?)\[/raw\]}is'; $pieces = preg_split($pattern_full, $content, -1, PREG_SPLIT_DELIM_CAPTURE); foreach ($pieces as $piece) { if (preg_match($pattern_contents, $piece, $matches)) { $new_content .= $matches[1]; } else { $new_content .= wptexturize(wpautop($piece)); } } return $new_content; } remove_filter('the_content', 'wpautop'); remove_filter('the_content', 'wptexturize'); add_filter('the_content', 'my_formatter', 99); ?> portfolio.php <?php /* Template Name: Portfolio */ ?> <?php get_header(); ?> <!-- #content BEGIN --> <div id="content" class="clearfix"> <ul class="filterable-grid clearfix"> <?php $wpbp = new WP_Query(array( 'post_type' => 'portfolio', 'posts_per_page' =>'-1' ) ); ?> <?php if ($wpbp->have_posts()) : while ($wpbp->have_posts()) : $wpbp->the_post(); ?> <?php $terms = get_the_terms( get_the_ID(), 'filter' ); ?> <li data-id="id-<?php echo $count; ?>" data-type="<?php foreach ($terms as $term) { echo strtolower(preg_replace('/\s+/', '-', $term->name)). ' '; } ?>"> <?php if ( (function_exists('has_post_thumbnail')) && (has_post_thumbnail()) ) : ?> <?php the_post_thumbnail('portfolio'); ?> <?php endif; ?> <p><a href="<?php the_permalink(); ?>"><?php echo get_the_title(); ?></a></p> </li> <?php $count++; ?> <?php endwhile; endif; ?> <?php $large_image = wp_get_attachment_image_src( get_post_thumbnail_id(get_the_ID()), 'fullsize', false, '' ); $large_image = $large_image[0]; ?> <?php wp_reset_query(); ?> </ul> </div><!-- #content END --> <?php get_sidebar(); ?> <?php get_footer(); ?> portfolio-post-types.php <?php // function: post_type BEGIN function post_type() { $labels = array( 'name' => __( 'Portfolio'), 'singular_name' => __('Portfolio'), 'rewrite' => array( 'slug' => __( 'portfolio' ) ), 'add_new' => _x('Add Item', 'portfolio'), 'edit_item' => __('Edit Portfolio Item'), 'new_item' => __('New Portfolio Item'), 'view_item' => __('View Portfolio'), 'search_items' => __('Search Portfolio'), 'not_found' => __('No Portfolio Items Found'), 'not_found_in_trash' => __('No Portfolio Items Found In Trash'), 'parent_item_colon' => '' ); $args = array( 'labels' => $labels, 'public' => true, 'publicly_queryable' => true, 'show_ui' => true, 'query_var' => true, 'rewrite' => true, 'capability_type' => 'post', 'hierarchical' => false, 'menu_position' => null, 'supports' => array( 'title', 'editor', 'thumbnail' ) ); register_post_type(__( 'portfolio' ), $args); } // function: post_type END // function: portfolio_messages BEGIN function portfolio_messages($messages) { $messages[__( 'portfolio' )] = array( 0 => '', 1 => sprintf(('Portfolio Updated. <a href="%s">View portfolio</a>'), esc_url(get_permalink($post_ID))), 2 => __('Custom Field Updated.'), 3 => __('Custom Field Deleted.'), 4 => __('Portfolio Updated.'), 5 => isset($_GET['revision']) ? sprintf( __('Portfolio Restored To Revision From %s'), wp_post_revision_title((int)$_GET['revision'], false)) : false, 6 => sprintf(__('Portfolio Published. <a href="%s">View Portfolio</a>'), esc_url(get_permalink($post_ID))), 7 => __('Portfolio Saved.'), 8 => sprintf(__('Portfolio Submitted. <a target="_blank" href="%s">Preview Portfolio</a>'), esc_url( add_query_arg('preview', 'true', get_permalink($post_ID)))), 9 => sprintf(__('Portfolio Scheduled For: <strong>%1$s</strong>. <a target="_blank" href="%2$s">Preview Portfolio</a>'), date_i18n( __( 'M j, Y @ G:i' ), strtotime($post->post_date)), esc_url(get_permalink($post_ID))), 10 => sprintf(__('Portfolio Draft Updated. <a target="_blank" href="%s">Preview Portfolio</a>'), esc_url( add_query_arg('preview', 'true', get_permalink($post_ID)))), ); return $messages; } // function: portfolio_messages END // function: portfolio_filter BEGIN function portfolio_filter() { register_taxonomy( __( "filter" ), array(__( "portfolio" )), array( "hierarchical" => true, "label" => __( "Filter" ), "singular_label" => __( "Filter" ), "rewrite" => array( 'slug' => 'filter', 'hierarchical' => true ) ) ); } // function: portfolio_filter END add_action( 'init', 'post_type' ); add_action( 'init', 'portfolio_filter', 0 ); add_filter( 'post_updated_messages', 'portfolio_messages' ); jquery.custom.js Code: [Select] function portfolio_quicksand() { // Setting up our variables var $filter; var $container; var $containerClone; var $filterLink; var $filteredItems // Set our filter $filter = $('.filter li.active a').attr('class'); // Set our filter link $filterLink = $('.filter li a'); // Set our container $container = $('ul.filterable-grid'); // Clone our container $containerClone = $container.clone(); // Apply our Quicksand to work on a click function // for each of the filter li link elements $filterLink.click(function(e) { // Remove the active class $('.filter li').removeClass('active'); // Split each of the filter elements and override our filter $filter = $(this).attr('class').split(' '); // Apply the 'active' class to the clicked link $(this).parent().addClass('active'); // If 'all' is selected, display all elements // else output all items referenced by the data-type if ($filter == 'all') { $filteredItems = $containerClone.find('li'); } else { $filteredItems = $containerClone.find('li[data-type~=' + $filter + ']'); } // Finally call the Quicksand function $container.quicksand($filteredItems, { // The duration for the animation duration: 750, // The easing effect when animating easing: 'easeInOutCirc', // Height adjustment set to dynamic adjustHeight: 'dynamic' }); }); $container.quicksand($filteredItems, function () { lightbox(); } ); } function lightbox() { jQuery("a[rel^='prettyPhoto']").prettyPhoto({ animationSpeed:'fast', slideshow:5000, theme:'pp_default', show_title:false, overlay_gallery: false, social_tools: false }); } if(jQuery().prettyPhoto) { lightbox(); } the script here is the simplest progress bar ever.. what I want is for the value of the mutiplier (so how fast it loads) to be a php varible pulled from the users file <html> <head> <script type="text/javascript"> function progress() { if (document.images["bar"].width < 400) { document.images["bar"].width += 5; document.images["bar"].height = 5; } else { clearInterval(ID); } } var ID; window.onload = function() { ID = setInterval("progress();", 500); } </script> </head> <body> <img src="black.gif" name="bar" /> </body> </html> POSSIBLE? hi. i have a page B which has an image on it. When the page loads i want it to auto click on that image. I wrote the code below but it does not autoclick. can you please help? <script language="javascript"> function autoClick() { document.getElementById('thisLink').click(); } </script> <php> $visitpage = "http://mywebsitei.com/wp-content/uploads/12345.jpg"; <div style="text-align: center;" ######="setTimeout('autoClick();',3000);"> <a href=<?php echo $visitpage ?> rel="lightbox" > <img src=<?php echo $visitpage; ?> alt=""/></a> </div> </php> I need some help. I'm having trouble calling a javascript function from a php script Code: [Select] <?php include ('security.inc'); include ('head.inc'); echo ' <table class="menutable"> <tr> <td nowrap> <div id="sidemenu" style="display:block;"> <ul id="navbar">'; // database-driven menu groups // get the menu items and groups that this user has access to if (!isset($_SESSION['usergroupsin']) || $_SESSION['usergroupsin']==''){ $menurs=array(); } else { $sql="SELECT mg_name, mg_desc, mi_name, mi_desc, mi_link, mi_external_link, mgg_gr_id, mig_gr_id FROM tbl_menu_items INNER JOIN tbl_menu_groups ON mi_mg_id=mg_id AND mg_active='y' LEFT JOIN tbl_menu_groups_groups ON mgg_mg_id=mg_id AND mgg_active='y' LEFT JOIN tbl_menu_items_groups ON mig_mi_id=mi_id AND mig_active='y' WHERE ( mgg_gr_id IN (".$_SESSION['usergroupsin'].") OR mig_gr_id IN (".$_SESSION['usergroupsin'].") OR mi_secure='n' ) AND mi_active='y' AND mg_left_menu='y' GROUP BY mg_name, mg_desc, mi_name, mi_desc, mi_link, mi_external_link ORDER BY mg_sort, mi_sort"; $menurs=myload($sql); } $last_mg_name=''; if (count($menurs)>0){ foreach ($menurs as $m){ // show the group heading if we haven't already shown it if ($m['mg_name']<>$last_mg_name){ echo '<li><strong> <br>'.$m['mg_name'].'</strong></li>'; $last_mg_name=$m['mg_name']; } // determine whether this is a system link or not if ($m['mi_external_link']=='y'){ $thisurl=$m['mi_link']; } else { $thisurl=$config['system_url_root'].$m['mi_link']; } echo '<li><a title="'.$m['mi_desc'].'" href="'.$thisurl.'"><strong> - '.$m ['mi_name'].'</strong></a></li>'; } } echo ' </ul> </div> </td> [b]<input class="button" type="button" value="Hide Menu" onclick="setTable('sidemenu');return true">[/b] <td width="100%"> <div id="mainwindow"> <!-- BEGIN PAGE CONTENT --> '; ?> My javacscipt function is in the head.inc. I can post that if needed. The bolded part is what I'm having trouble with. Specifically, the onclick. Without that, my script works, if I have the onclick in there, I get a blank page. I'm trying to hide/show the div=sidemenu. If anybody has any suggestions, I'm open to it. I'm trying to have a javascript confirm box pop up and confirm the intention to delete a record in a database. I think I'm having trouble calling the function within my PHP code, but not sure what exactly is wrong. The status bar shows something like "javascript:checkDelete(100, Title)" when I hover over the link and that seems right but nothing occurs when I click on it. Here is my code: Javascript Code: [Select] <script language="Javascript"> function checkDelete(b,Title){ var del=confirm("Are you sure you want to delete " + Title + " from the Database?"); if (del){ document.location="delete.php?mID=" + b + "&Title=" + Title; } } </script> PHP echo "<td><a href='Javascript:checkDelete(" . $row['mID'] . "," . $row['Title'] . ")'>"; echo "<img border=0 src='images/delete.gif'>" . "</a></td></tr>"; Anyone see my error? I wonder whether someone may be able to help me please. I'm currently running the code below (originating from nearby.org.uk) to convert OS Grid References to Latitude and Longtiude co-ordinates. Code: [Select] function converttolatlng() { var gr = document.getElementById('osgridref').value; var osgb = new GT_OSGB(); if (osgb.parseGridRef(gr)) { var wgs84 = osgb.getWGS84(); document.getElementById('osgb36lat').value = wgs84.latitude; document.getElementById('osgb36lon').value = wgs84.longitude; } else { document.getElementById('osgb36lat').value = "n/a"; document.getElementById('osgb36lon').value = "n/a"; } } This code is run through a 'click' event from a button on a HTML form and then the record is saved to a mySQL database. However, once a month, I have a list of approx 20,000 OS Grid References which need converting and saving to the same mySQL database. To do this manually on a button click wouldn't be very practical, so I've been working on doing this automatically. I may very well be doing this the wrong way, but I've been using the PHP script below to extract the two pieces of information I need from the xml file, the first is the 'Name, and the second is the 'NGR', and it is this field that needs converting. Code: [Select] <? $objDOM = new DOMDocument(); $objDOM->load("scheduledmonuments.xml"); $Details = $objDOM->getElementsByTagName("Details"); foreach( $Details as $value ) { $Name = $value->getElementsByTagName("Name"); $name = $Name->item(0)->nodeValue; $NGR = $value->getElementsByTagName("NGR"); $ngr = $NGR->item(0)->nodeValue; echo "$name :: $ngr <br>"; } ?> This is where I've become a little stuck because I'm not sure how to get the data converted and to a point where it can be saved to the relevant fields in my database. I just wondered whether someone would perhaps take a look at this please and let me know what I need to do. Many thanks I would like to put an ad delay onto a webpage. No content shows up (complete white backgorund) until 30 seconds after viewing the ad. The ad would disappear and the content of the page would load up.
Hello all, i need your help on this.
I don´t know if it´s possible, and if possible, i don´t know how to do it.
I catch visitors country code using javascript in a variable called "country".
Then, i need to php include diferent files based on that country code, like:
if country == UK
include header_uk.php
else if country == US
include header_us.php
else if country == BR
include header_br.php
else
include header.php
I don´t know nothing about coding, this is just an example.
I don´t have another way of catching visitors country without javascript.
Is this possible?
Thanks in advance.
Edited by vascorama, 17 August 2014 - 01:49 PM. well i got more questions since i started at javascript and now im currently practicing php my question is whats the equivalent of this lines of codes to php language? document.getElementById("txt1").value <input type="button" name="one" id="one" value="1" onclick="javascript:getvalue(1);"\> == well what i mean is can i pass value to php functions every time i click it? just like calculators OT: can some1 help me translating my js calcu codes to php ones? document.getElementById("txt1").value this is my main problem i cant display the buttons i click Hello, I'm currently working on a gaming website, however there is an issue. I have a custom YouTube player, however I need to get the link dependant on a value from the database. The ID is in the URL, which is then collecting the youtube video URL from the database. However, I'm trying to then echo that back out into the Javascript video. On my normal page, that plays the Video is: Header: Styles.css & youTubeEmbed-jquery-1.0.css need to be added. Code: [Select] <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Having Fun With YouTube's API - Making a Custom Video Player | Tutorialzine Demo</title> <link rel="stylesheet" type="text/css" href="styles.css" /> <link rel="stylesheet" type="text/css" href="video_player/youTubeEmbed/youTubeEmbed-jquery-1.0.css" /> </head> Footer: All of that needs to be added. Code: [Select] <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script> <script src="jquery.swfobject.1-1-1.min.js"></script> <script src="youTubeEmbed/youTubeEmbed-jquery-1.0.js"></script> <script type="text/javascript"> $(document).ready(function(){ $('#player').youTubeEmbed("VID LINK FROM DB SHOULD BE HERE"); $('form').submit(function(){ $('#player').youTubeEmbed({ video : 'VID LINK FROM DB SHOULD BE HERE', width : 640, // Height is calculated automatically progressBar : false // Hide the progress bar }); }); }); </script> </body> </html> Code: [Select] <?php include("config.php"); $host = $config['Site']['Host']; $username = $config['Site']['Username']; $password = $config['Site']['Password']; $database = $config['Site']['Database']; $name = $config['Site']['Name']; $favicon = $config['Site']['Favicon']; mysql_connect($host, $username, $password) or die(mysql_error()); mysql_select_db($database) or die(mysql_error()); function getVid() { $vID = $_GET['vID']; $sQuery = "SELECT * FROM vids WHERE id='$vID'"; $sResult = mysql_query($sQuery); while($row = mysql_fetch_array($sResult)) { $vID = $row['url']; } } ?> Above is the Global.php, and that's where the problem lies, whenever I try to insert the peices required, nothing happens and the video doesn't show. Could anybody please help?! <html> <head> <script type=\"text/javascript\" src=\"swfobject.js\"></script> </head> <body> <script type=\"text/javascript\"> var multiplayer = new SWFObject(\"player.swf?xml=config.xml&player_skin=skin.swf\", \"multiVideoPlayer\", \"361\", \"283\", \"7\", \"#FFFFFF\", true); multiplayer.write(\"flashcontent\"); </script> </body> </html>Hi, Could anyone help make the above code run inside my PHP file? When loaded, I just get a blank page and I know the paths to files are correct. Thank you Edited by hexcode, 11 July 2014 - 01:19 PM. New to PHP/Java. Need some help!!! I need the textarea of a site to save what is entered into a text file. I also need javascript to use a pre-validate pop up box, if no data is entered. I can't get both of them to work at the same time. Below is my code. Code: [Select] <html> <head> <link rel="stylesheet" type="text/css" href="style.css"/> <script type="text/javascript"> <!-- <!CDATA[ function validateForm() { var x=document.forms["myForm"]["email"].value; var atpos=x.indexOf("@"); var dotpos=x.lastIndexOf("."); if (atpos<1 || dotpos<atpos+2 || dotpos+2>=x.length) { alert("Not a valid e-mail address"); return false; } } // ]]> --> </script> </head> <form name="form1" method="post" action="index2.php?saving=1"> <textarea name="data" cols="100" rows="10"> Username: Password: --------------------------------------------- </textarea> <br> </form> <form name="myForm" method ="post" action="index2.php?saving=1" onsubmit="return validateForm();"> <tr> <td align="right" width="10%"> Email: </td> <td><input type="text" name="email" id="email" size ="40" /> </td> </tr> <input type="submit" value="Submit"> </form> <p> <a href="index.html">Home</a> </html> PHP CODE: Code: [Select] <?php $saving = $_REQUEST['saving']; if ($saving == 1){ $data = $_POST['data']; $file = "data.txt"; $fp = fopen($file, "a") or die("Couldn't open $file for writing!"); fwrite($fp, $data) or die("Couldn't write values to file!"); fclose($fp); echo "Saved to $file successfully!"; } ?> so I am not the best coder, and have been having a really hard time getting this devision in javascript. I would put it in html, but I use javascript to clear the page
<div id="test" style='position:fixed;bottom:0;left:0; height:76;background:darkorange;width:100%;'><h><object width="75" onclick="web()" height="75" data="img1.jpg"></object> <object width="75" onclick="mdoge()" height="75" data="img2.jpg"></object> <object width="75" onclick="word()" height="75" data="img3.jpg"></object></h></div>so that code above is the code I need to put in a document.write of something of equivalence. Is there any way to put this in javascript? thank you |