Jump to content

Search the Community

Showing results for tags 'echo'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • W3Schools
    • General
    • Suggestions
    • Critiques
  • HTML Forums
    • HTML/XHTML
    • CSS
  • Browser Scripting
    • JavaScript
    • VBScript
  • Server Scripting
    • Web Servers
    • Version Control
    • SQL
    • ASP
    • PHP
    • .NET
    • ColdFusion
    • Java/JSP/J2EE
    • CGI
  • XML Forums
    • XML
    • XSLT/XSL-FO
    • Schema
    • Web Services
  • Multimedia
    • Multimedia
    • FLASH

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Languages

Found 10 results

  1. Hi all, I have a php file to check a users input and it seems pretty straight-forward as far as logic goes, but the variable seems to be concatenating the "badEntry" onto its return value. I've been over it and over it and can't seem to see what's wrong. I originally had $userInput as the only return variable, but when I started having trouble I added the $toReturn variable to hopefully make it clear what I was doing wrong. Didn't help. I enter 'sakde12345' and I get that back with 'BadEntry' concatenated to it - looks like this - sakde12345BadEntry. My callback function is supposed to see if the return value is equal to 'BadEntry' and of course it isn't because it somehow includes the original input in front of it. It's returning this for either 'good' or 'bad' input. Can anyone figure out how I've miscoded or what? I also had a question about the debugger in chrome when I was running the js that called this php in the xmlhttprequest. The debugger traced thru everthing OK, but when it came to the 'onreadystatechange', it went to the 'xhr.open' line, jumped back to the onreadystatechange ( which became 1) but then it jumped to the requestheader line, then the .send line, then it jumped back to the js function that called the xhr request, then it jumped all the way back to the button in html that submitted the input. That kind of surprised me to see that - is the program just gathering information to proceed or something like that? I know it's kind of a weird question, but I'd like to understand what is going on. Thanx for any help, and I appreciate your patience!!! <?php $toReturn = ""; $userInput = ""; $chars = []; $i = 0; if ($_SERVER["REQUEST_METHOD"] == "POST"){ $userInput = $_POST["userID"]; // Get variable passed to xmlhttp call $userInput = test_input($userInput); // Run it thru easy data cleaner $userInput = strtolower($userInput); // change all to lower case $toReturn = $userInput; $chars = str_split($userInput); // split input into single characters if (strlen($userInput) != 10) { // is the input exactly 10 chars long $toReturn = "BadEntry"; } else { if (substr($userInput,0,3) != "sak") { // are the 1st 3 letters 'sak' $toReturn = "BadEntry"; } else { if (is_not_Char($chars[3]) || is_not_Char($chars[4])) { // are the 4th & 5th chars letters - name initials $toReturn = "BadEntry"; } else { for ($i = 5; $i < 10; $i++){ if (is_not_Numb($chars[$i])) { // are the last 5 chars Numbers $toReturn = "BadEntry"; } } } } } } echo $toReturn; function is_not_Char($examp){ $charBool = false; if ($examp < chr(97) || $examp > chr(122)) { // is it a lowercase letter - ascii 97 - 122 $charBool = true; } echo $charBool; } function is_not_Numb($examp){ $charBool = false; if ($examp < chr(48) || $examp > chr(57)) { // is it a number - ascii 48 - 57 ( 0 - 9 ) $charBool = true; } echo $charBool; } function test_input($data) { // standard data cleansing tools $data = trim($data); $data = stripslashes($data); $data = htmlspecialchars($data); echo $data; } ?>
  2. Hi, I am working on a website that users can log into from one page and administrate their users from another. first page is index.php and second is admin.php. on the index page I have a form to login with that calls out to a stand alone .php script called "checklogin.php" here is the code... <?php ob_start(); $host=; // Host name $username=; // Mysql username $password="; // Mysql password $db_name="; // Database name $tbl_name="; // Table name // Connect to server and select databse. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); // Define $login and $pass $login=$_POST['login']; $pass=$_POST['pass']; // To protect MySQL injection (more detail about MySQL injection) $login = stripslashes($login); $pass = stripslashes($pass); $login = mysql_real_escape_string($login); $pass = mysql_real_escape_string($pass); $sql="SELECT * FROM Registration WHERE login='$login' and pass='$pass'"; $result=mysql_query($sql); // Mysql_num_row is counting table row $count=mysql_num_rows($result); // If result matched $login and $pass, table row must be 1 row if($count==1){ session_register("login"); session_register("pass"); header("location:Admin.php"); } else { echo "<script language='javascript'> alert('Sorry, but you must login to view the members area!') </script> <script> window.location='index.php' </script>"; } ob_end_flush(); ?> my admin page has this script on it as a redirect... <?php session_start(); if(!session_is_registered(login)){ header("admin.php"); } ?> my question is...how can I echo out user specific data with this code onto the admin page in a div? since the code is living outside the admin page, I cant figure out how to do it...any help, thanks!
  3. george

    This should be real simple

    Here is my code: The code fails at line 36: $txt = substr($mtcontent, 0, strpos($mtcontent, "</title>")+7); <!DOCTYPE HTML><html><head> <meta charset="utf-8"> <title>Untitled Document</title> <style type="text/css"> body { margin:20px; padding:0; background-color:#0000FF; color:#FFFF00; } </style></head><body><h3>/* make a copy of the file to parse for assurance */</h3><br><?php copy("C:UsersownerDesktopPLUcodes.htm", "C:UsersownerDesktopworkfile.htm"); if(!file_exists("C:UsersownerDesktopworkfile.htm")) { die("File not found"); } else { echo "got copy"; }?><br><h3>/* get a file handel for the workfile */</h3><br><?php $myfile = fopen("C:UsersownerDesktopworkfile.htm", "r") or die("Unable to open file!");?><h3>/* copy content of workfile into a var, $mtcontent, for parsing */</h3><br><?php $mtcontent = fread($myfile,filesize("C:UsersownerDesktopworkfile.htm"));?><h3>/* we don't need the file workfile.htm open anymore, so close it using the file handel for that file */</h3><br><?php fclose($myfile);?><h3>/* get the content of our string from the first byte up to the closing title tag */</h3><br><h3>/* well put it in a varable called $txt */</h3><br><?php $txt = substr($mtcontent, 0, strpos($mtcontent, "</title>")+7); echo $txt;?><h3>/* then add the string litteral <head><body> to the end of our string */</h3><br><h3>/* have to use the HTML code for the grater and less than symbols, else won't work */</h3><br><?php $txt .= '<head><body>'?><h3>/* lets see what we have */<h3><br><?php echo $txt;?></body></html> I have tried using strpos($mtcontent, "<‚ĀĄtitle>") instead of strpos($mtcontent, "</title>") But that causes the page to render strangely wrong. At the end of the page, I want to echo the variable txt, but it appears to be empty.
  4. Hi folks! I have been using relatively clean and simple PHP contact forms for quite some time now. They fit my needs and are easy to work with. However, after submitting the message, it takes me to a gray screen with the nothing but text I programmed it to echo. It isn't an error or bug, but it's an ugly redirect and does not look professional. I would like to learn how to work with this in one of two ways: either submit the message without leaving the contact page, or add a redirect of some sort. This is the contact.php file I use. If anyone has input on how to do this, it'd be greatly appreciated!! <?phpfunction spamcheck($field) { //filter_var() sanitizes the e-mail //address using FILTER_SANITIZE_EMAIL $field=filter_var($field, FILTER_SANITIZE_EMAIL); //filter_var() validates the e-mail //address using FILTER_VALIDATE_EMAIL if(filter_var($field, FILTER_VALIDATE_EMAIL)) { return TRUE; } else { return FALSE; } }if (isset($_REQUEST['email'])) {//if "email" is filled out, proceed //check if the email address is invalid $mailcheck = spamcheck($_REQUEST['email']); if ($mailcheck==FALSE) { echo "Invalid input. Please enter a valid email address."; } else {//send email $name = $_POST['name'] ; $email = $_POST['email'] ; $message = $_POST['message'] ; $totalmessage = " Name: $name n Details: $message n"; mail("email@email.com", "Email: $email", $totalmessage, "From: $email" ); echo "Thank you for contacting me. I'll get back with you ASAP."; } }else { //if "email" is not filled out, display the form?> <form method="post" action="contact.php"> <div class="row half"> <div class="6u"><input type="text" name="name" placeholder="Name" /></div> <div class="6u"><input type="email" name="email" placeholder="Email" /></div> </div> <div class="row half"> <div class="12u"><textarea name="message" placeholder="Message" rows="6"></textarea></div> </div> <div class="row"> <div class="12u"> <ul class="actions"> <li><input type="submit" value="Send Message" name="submit" /></li> </ul> </div> </div> </form><?php}?>
  5. Hi, I've been working with the indeed jobs API and I have a line break after the title that Id'like to get rid off. Jobs Results: Graduate Scheme - 2015 Crossrail Ltd (2 days ago) London - Crossrail vacancies Graduate Scheme - 2015 Graduate Scheme - 2015 Job title Graduate Scheme - 2015... visit our designated Graduate Scheme page for more... Here is the code: foreach($xml->results->result as $result) {echo "<h3><a href=".$result->url.">".$result->jobtitle."</a></h3>";echo "<p><b>".$result->company."</b> (".$result->formattedRelativeTime.") <b>".$result->city."</b> - ".$result->snippet."</p>";} ?> I can't find out why there is a line break between the two echo, any idea? Many Thanks,
  6. Hi, I have a JQuery code that read the value echo back from php, it echo a value "1" as shown the code bellow, however I get additional information from the variable as shown in the result, how can I get rid of this? JQuery Code on index.html$("#login").click(function(){ $.post("php/connect.php", {id:"?????", pw:"????"}, function(data) { alert(data); });});Php Code on connect.phpif($id != null && $pw != null && $row[1] == $id && $row[2] == $pw){ echo '1';else{ echo '0';}Result that return at variable data<meta http-equiv="Content-Type" c /><meta http-equiv="Content-Type" c />1
  7. i'm trying to send information to the following page but can't seem to do so. this might be a html problem i build an if (isset($_REQUEST[""])) to have one side link and another form. problem is that for the image link i set up, i can't send value to the following page <?phpif (isset ($_REQUEST['code']))$code=$_REQUEST['code'];$phone=$_REQUEST['phone'];?> <html><head><title></title></head><body> <?php if (isset($_REQUEST['code'])) echo "</br> <a href=\"request.php\?code&&phone"><img src=\"../images/button1.png\" onmouseover=\"this.src=\'../images/button1-hover.png\'\" onmouseout=\"this.src=\'../images/button1.png\'\"/></a>"; else echo "form"?> </body></html> I thought all i have to do is add ?code&&phone to the <a href> tag.. what am i doing wrong Please help. Thank you
  8. Hello internet. I have been sending my site out to people to test out and mess around with and some feedback I am getting is that they are having pop-up blocker issues and even when they temporarily turn the pop-up blockers off they still do not get my echo's that I really need them to get. So - how do I send the echo right to the same webpage that the form is on?
  9. Krewe

    If() = Echo " Selected"

    Hello, I am currently trying to make a form that when edited will updated what the table on the front page shows.The way it will work is by updating a MySQL database. In my code for the form I want it to grab the "flavor" that is currently showing, and place it as the " selected" in the option field, so who ever edits it can see right there which flavors are already showing. Please note there are TWO different tables in the DB, one table holds ALL of the flavors, the other holds only 8 flavors that will show on the front page: Code: <table><tr><td><h1>Change Flavors:</h1><br /></td></tr> <?php while($count <= 8){ echo "<tr><td><form>"; echo "Flavor #{$count}: "; echo "<select name=\"in_store\">"; $flavor_set = get_flavors(); $in_store_set = get_flavors_in_store(); $in_store = mysql_fetch_array($in_store_set); while($flavors = mysql_fetch_array($flavor_set)){ echo "<option value=\"{$flavors['flavor_name']}\""; if($flavors['flavor_name'] == $in_store['flavor']){ echo " selected"; } echo ">{$flavors['flavor_name']}</option>"; } echo "</select>"; echo "<input type=\"submit\" value=\"Edit Flavor #{$count}\""; $count++; echo "</form><br /><br />"; echo "<img src=\"images/line.png\" width='500px' height='2px' /><br /><br />"; echo "</td></tr>"; }?></table> The table that holds all the flavors is $flavor_set, the home page table is $in_store_setget_flavors() and get_flavors_in_store() and two functions that I have set to get the info out of the DB. Thanks!
  10. Hello everyone! The reason I came to these forums is because i have an issue with my code, could you guys look at it and tell me what i am doing wrong?I am trying to retrieve an image from my SQL database in the form of a binary blob, but it doesn't show up. This is the code of the PHP file i am using in my image src html tag: <?phprequire_once("connect.php"); $imgd = $_get['img'];$query="SELECT * FROM ads WHERE id=$imgd";$result=mysql_query($query) or die ("Error - ");$row = mysql_fetch_assoc($result);$image = $row['fotolocatie']; echo $image;;?> it doesn't show the error so it isn't the query witch fails. - Kevin
×