PHP - [php] Continuing Query Brain Fail
Please are going to start hating me about this haha.
Hey guys i have been trying to do this for a few hours and my brain is hurting haha hope someone can help. Ok here is what i am trying to do. I have been making a website that allows users to make friends below is my friends table:: NAME: member_friends id friend_id << Person who has been sent the friend request my_id << Person who sent the friend request friend_since << when did they become friends is_friend << is set to 0 then friend request pending and this is the member_topics message_id member_id << this stores the id of the member from the members table message_contents << stores their message message_date message_reported << if set to 1 the message has been reported Ok basically i want the messages to be displayed on the members home page if they are friends, so if my name is JamesDean and i befriended a person called Harry if i post a message i want harry to see this and any other friends i may have. Same goes for their messages. Sorry if im confusing you stay with me. Ok here is what i am trying to do (did i mention im fairly new to php so please if im doing something wrong dont hurt me (: ) $query = mysql_query("SELECT * FROM member_friends"); while($row = mysql_fetch_array($query)){ $friend_id = $row['friend_id']; // Ok this is where i want the while loop to loop through all of my friends // Ok set up the new filter im gunna get lost here now $sql = mysql_query("SELECT a.*,b.* FROM member_topics as a, member_friends as b WHERE (a.member_id = b.my_id OR a.member_id = b.my_id) AND ((b.friend_id = '$friend_id') AND b.my_id = '$my_id') ORDER BY a.message_id DESC"); // $my_id is a variable created from session so thats ok and the $friend_id i want that to change fromt he first loop so the statement changes for all of my friends. // Sorry for the query above i have tried that many i dont even know my gender anymore // So while loop in a while loop i think while($row = mysql_fetch_array($sql)){ $message_id = $row['message_id']; $member_id = $row['member_id']; $message_contents = $row['message_contents']; $message_date = $row['message_date']; $message_type = $row['message_type']; $message_reported = $row['message_reported]; } } something like this hope someone can point me in the right direction before my brain fails thanks in advanced!!!!!!! Similar TutorialsHelp. I used the great Simple SQL search tutorial provided by this site, but when I tried to customize it for my site, it keeps falling apart. I am a newbie, but any disgust at my idiocy is fine as long as I find a ball of string to lead me out of the labyrinth. Here's the code (modified from the tutorial) sans the login information: $con = mysql_connect($dbHost, $dbUser, $dbPass) or trigger_error("Failed to connect to MySQL Server. Error: " . mysql_error()); mysql_select_db($dbDatabase) or trigger_error("Failed to connect to database {olsendai_ssn}. Error: " . mysql_error()); // Set up our error check and result check array $error = array(); $results = array(); // First check if a form was submitted. // Since this is a search we will use $_GET if (isset($_GET['search'])) $searchTerms = trim($_GET['search']); $searchTerms = strip_tags($searchTerms); // remove any html/javascript. if (strlen($searchTerms) < 3) { $error[] = "Search terms must be longer than 3 characters."; }else { $searchTermDB = mysql_real_escape_string($searchTerms); // prevent sql injection. } // If there are no errors, lets get the search going. if (count($error) < 1) { $searchSQL = "SELECT name, ssn FROM simple_search WHERE "; // grab the search types. $types = array(); $types[] = isset($_GET['name'])?"`name` LIKE '%{$searchTermDB}%'":''; $types[] = isset($_GET['ssn'])?"`ssn` LIKE '%{$searchTermDB}%'":''; $types = array_filter($types, "removeEmpty"); // removes any item that was empty (not checked) if (count($types) < 1) $types[] = "`name` LIKE '%{$searchTermDB}%'"; // use the name as a default search if none are checked $andOr = isset($_GET['matchall'])?'AND':'OR'; $searchSQL .= implode(" {$andOr} ", $types) . " ORDER BY `ssn`"; // order by ssn. $searchResult = mysql_query($searchSQL) or trigger_error("There was an error.<br/>" . mysql_error() . "<br />SQL Was: {$searchSQL}"); if ($num_rows < 1 ) { echo '<b>No Titles Found.</b><br><br><br>'; } }else { $results = array(); // the result array $i = 1; while ($row = mysql_fetch_assoc($searchResult)) { $results[] = "{$i}: {$row['ssn']}<br /><br />{$row['name']}<br /><br />"; $i++; } } } function removeEmpty($var) { return (!empty($var)); } ?> <html> <title>My Simple Search Form</title> <style type="text/css"> #error { color: red; } </style> <name> <?php echo (count($error) > 0)?"The following had errors:<br /><span id=\"error\">" . implode("<br />", $error) . "</span><br /><br />":""; ?> <form method="GET" action="<?php echo $_SERVER['PHP_SELF'];?>" name="searchForm"> Search For: <input type="text" name="search" value="<?php echo isset($searchTerms)?htmlspecialchars($searchTerms):''; ?>" /><br /> Search In:<br /> name: <input type="checkbox" name="name" value="on" <?php echo isset($_GET['name'])?"checked":''; ?> /> | ssn: <input type="checkbox" name="ssn" value="on" <?php echo isset($_GET['ssn'])?"checked":''; ?> /> | /><br /> Match All Selected Fields? <input type="checkbox" name="matchall" value="on" <?php echo isset($_GET['matchall'])?"checked":''; ?><br /><br /> <input type="submit" name="submit" value="Search!" /> </form> <?php echo (count($results) > 0)?"Your search term: {$searchTerms} returned:<br /><br />" . implode("", $results):""; ?> </name> </html> When I try this, it gives me this message: Parse error: syntax error, unexpected '}' in /home/olsendai/public_html/sqlfour.php on line 65. Help. Please! It seems simple, but when I remove the unexpected '}', it comes back with this error - before I have even used the search feature Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /home/olsendai/public_html/sqlfour.php on line 60 The following had errors: Search terms must be longer than 3 characters. Can someone help me with this error message...I tried another layout but I think I am getting the same problem where it is not recognizing the next page of the sessions and including the id for a member to continue Invalid query: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 'Resource id #4' at line 1 Whole query:Resource id #4 This is the page. <?php session_start(); ?> <?php ini_set ("display_errors", "1"); error_reporting(E_ALL); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Welcome</title> </head> <body> <?php /* Program: login.php * Desc: Displays the new member welcome page. Greets * member by name and gives a choice to enter * restricted section or go back to main page. */ include('Connections/connect_to_mysql.php'); $id = ''; $firstname = ''; $lastname = ''; $country = ''; $email = ''; //Formulate Query //This is the best way to perform an SQL query $query = mysql_query("SELECT id,firstname FROM `Members` WHERE id='%s' AND firstname='%s'"); //Perform Query $result = mysql_query($query); //Check result //This shows the actual query sent to MySQL and the error. Useful for debugging. if(!$result){ $message = 'Invalid query:' . mysql_error() . "\n"; $message .= 'Whole query:' . $query; die($message); } //Use result //Attempting to print $result won't allow access to information in the resource //One of the mysql result functions must be used //See also mysql_result(), mysql_fetch_array(), mysql_fetch_row(), etc. while($row=mysql_fetch_assoc($result)){ echo Welcome, $row['firstname']; } //Free the resources associated with the result set mysql_free_result($result); ?> <p>Your new Member accounts lets you enter the members only section of our web site. You'll find special discounts, a profile of matches, live advise from experts, and much more.</p> <p>Your new Member ID and password were emailed to you. Store them carefully for future use.</p> <div style="text-align: center"> <p style="margin-top: .5in; font-weight: bold"> Glad you could join us!</p> <form action="profile.php" method="post"> <input type="submit" value="Enter the Members Only Section"> </form> <form action="index.php" method="post"> <input type="submit" value="Go to Main Page"> </form> </div> </body> </html> I have this one issue. While logging in into our system, we call a routine called getToken(). This calls a routine on another server (used to be able to securely access documents). The issue we have is if that other server goes down, this call fails, and the user isn't able to login. I want to make it so that even if the other server goes down, users can still login and access our system (just not documents). I know that I can't prevent fatal errors or even ignore them, correct (even with set_error_handler)? Any thoughts? It's a simple call, here's all it is: require_once('include/utils.php'); $token=getToken(); Now this one is a bit of a shit head. I am using a really comprehensive class i found on on the web for upload / re-size / crop but i want to be able to override it's error handling and i am not good enough to start modifying the code in the class with out fucking it up. Firstly i will show you how i have invoked the class. Code: [Select] if( isset($_FILES['image'] ) ) { //Class includes include("../scrips/php/cms/database.insert.class.php"); include ("../scrips/php/cms/img.upload.resize.crop.class.php.php"); //----------|Start: upload, resize & save $your_image = new _image; //----------| Upload orginal image $your_image->uploadTo = 'uploads/'; $upload = $your_image->upload($_FILES['image']); //----------| Resize and upload small thumbnail $your_image->newPath = 'thums/'; $your_image->newWidth = 50; $your_image->newHeight = 50; $resized = $your_image->resize(); //----------| Resize and upload medium thumbnail $your_image->newPath = 'thums2/'; $your_image->newWidth = 100; $your_image->newHeight = 100; $resized = $your_image->resize(); //----------| Getting the image name to insert into the database futher on in the code $name = $resized; $img_str = explode("/",$name); $final_img_name = $img_str['1']; echo "Article has been added!"; //----------------|end //----------------| Start database insert (class manipulation) $table = "blog_posts"; $title = "'".$_POST['ArticleTitle']."',"; $img = "'".$final_img_name."',"; $post = "'".$_POST['ArticleBody']."',"; $aurthor_id = "'1',"; $category_id = "'".$_POST['Category']."',"; $date_posted = "NOW()"; $values = array("$title","$img","$post","$aurthor_id","$category_id","$date_posted"); $fields = array('title,','img,','post,','aurthor_id,','category_id,','date_posted'); $obj= new DatabaseInsert; $obj->DatabaseConnectionRequire(); $obj->ArticleInsert($values,$fields,$table); //----------------|end } As you can see it's fairly basic. What i want to do is before it runs this script and starts including/invoking the class etc, i want to be able to check to see if there is a value been posted from a FILE FORM OBJECT and if there is to proceed with this script, alternatively i want it to execute another code which will handle it in regards to the concept of my page. A simple javascript alert with be ok providing it reloaded the page to it's default state. If any one can help me here i would appreciate it a lot. Thanks I think this problem requires LOTS of brainpower, and as I am absolutely convinced at this point that I have none, I was kind of hoping someone could steer me in the right direction at the very least. What I'm scripting right now is a search form that allows users to browse members based on what they type in the forms. There's about 8-10 forms of various criteria, such as age, country, birthdate, email, etc. And once they hit submit, all the information they typed gets sent to the url ($_GET, in other words). Now, the way I structured my script is like this: Code: [Select] <?php //If nothing was submitted (or if the url is completely blank) if ($_GET == array ()) { //Define a variable that will be used to query the members; in this case, it would select all members $query = "SELECT * FROM fans"; } else { //If the user typed at least one thing (in the form OR the url) if (count ($_GET) == 1) { //If what they typed is only for one criteria, define a variable that creates a query for only ONE criteria to search for $query = "SELECT * FROM fans WHERE"; foreach ($_GET as $field => $value) { $query .= " $field = '$value'"; } //If the user has typed in more than one field and hits search } else { //Define a variable for a query that selects members based off each criteria $query = "SELECT * FROM fans WHERE"; foreach ($_GET as $field => $value) { $query .= " $field LIKE '%$value%' AND"; } } } ?> Now, the problem with the above script is the very last part...defining a query to run if more than one field is selected. Because I'm using a foreach loop to structure that query, my options seem rather limited with what I can and can't do as far as querying the database. And the problem lies in where it says "$field LIKE '%$value%' AND". Because of the way the script is set up, the last $_GET variable will have "AND" at the very end, and when it runs through the mysql_query() function, it breaks, and does NOT work. Is there a way around this? I figure it probably requires some complex mathematical equation (one which I have absolutely no idea on how to create). Can anyone help? I am trying to create some navigation link with sublinks in a <ul> list. Here is the set up. Table = categories fields: id cattitle = title parentid = level of the link (0 = top level) cat_loc = the id value of the link that this link will be sublink of example: 1st link: id 1, title - home, parentid - 0, cat_loc - null; 2nd link: id - 5, title - info, parentid - 0, cat_loc - null; 3rd link: id - 6, title - test, parentid - 1, cat_loc - 5; so test should be a sublink of info. Here is what I have for code so far... <?php include $_SERVER['DOCUMENT_ROOT'] . './includes/magicquotes.inc.php'; include $_SERVER['DOCUMENT_ROOT'] . './includes/db.inc.php'; $result = mysqli_query($link, 'SELECT * From categories order by orderby asc'); if (!$result) { $error = 'Error getting categories: ' . mysqli_error($link); include 'error.php'; exit(); } while ($row = mysqli_fetch_array($result)) { $navlink[] = array('id' => $row['id'], 'cattitle' => $row['cattitle'], 'cat_loc' => $row['cat_loc'], 'parentid' => $row['parentid']); } echo '<ul>'; $count = 0; foreach ($navlink as $nav): { if ($nav['parentid'] == 0) { if ($count!=0){echo " | ";} echo '<li>' . '<a href="home.php?id=' . $nav['id'] . '"' . ' ' . 'title="' . $nav['cattitle'] . '">' . htmlspecialchars($nav['cattitle']) . '</a>'; $count++; } if ($nav['parentid'] != 0) { $result2 = mysqli_query($link, 'Select * From categories where "$nav[cat_loc]" = "$nav[id]"'); if (!$result2) { $error = 'Error getting categories: ' . mysqli_error($link); include 'error.php'; exit(); } echo '<ul>'; while ($row2 = mysqli_fetch_array($result2)) { $subnavlink[] = array('id' => $row2['id'], 'cattitle' => $row2['cattitle']); } foreach ($subnavlink as $subnav): { echo '<li>' . '<a href="home.php?id=' . $subnav['id'] . '"' . ' ' . 'title="' . $subnav['cattitle'] . '">' . htmlspecialchars($subnav['cattitle']) . '</a></li>'; } endforeach; } } endforeach; echo '</ul>'; yes I do have the php closed further down the page. Part of my problem is that the sublinks won't be in the database right after their parent links so I don't think the way I have my foreach loop set up is right. I know I don't have my <ul>'s and <li>'s closed correctly yet. I just want to get the subnavs to show up, I can fix those later. Any ideas? It's one of those days after a long weekend and a rainy morning. Simply trying to get the correct message depending on the variable's value if($a = 'one'){ echo "POOR";} if($a = 'two'){ echo "GOOD";} if($a = 'three'){ echo "VERY GOOD";} if($a = 'four'){ echo "EXCELLENT";} Not sure if I need to use ==, extra quotes, or ELSEIF for the best result.
Okay, I have a 3 column table layout on my forum, I want users to beable to select where they want 1 of there profile sections to go under, (and display order) either, left middle or Right side. See now I can code the javascript/etc ajax to make them update if selected to move to (any direction) But I need help to do it server side, what kind of value/row in my db should i use? just 1 field and use arrays? Also, let's say I want to move the "Calendar" to the middle or far right, and save that position, what kind of functions would i be working with (in php) I can prob do it if I use like 200 IF and ELSE conditions, but that would take way to long, any help? For some reason I cannot think today. Code: [Select] <?php class { function meh() { $blah = $this->profile(); echo $blah->weirdname; } function profile() { // this is where I'm stuck.. // how do I properly set weirdname? } } ?> It's been a while since I've played with classes (been doing other things) so how do I set up the function profile() to return a value for weirdname. I have an array $INFO = array( 'joebob' => 'password', 'fred' => 'password', 'tom'=> 'password' ); how can i just do a simple check to see if a name and password match? something like if (in_array(can'tthink)); thanks I've been trying to wrap my head around this for about two hours now. The file uploads just fine, the entry goes into the database just fine, EXCEPT for the file name like it's supposed to do. I wrote the code from scratch... it worked fine, then it broke (that's the way it's supposed to work, right?) Anyways, if anyone could take a look-see and point out what I'm missing? I've tried throwing errors on all the queries, I've made sure the filename is passed from the upload form, the form does have the proper enctype. require 'dbconfig.php'; $title = escape($_POST['title']); $content= escape($_POST['content']); $time = time(); //Check the file. if (!empty($_FILES['attachment'])) { //$filename = the name as saved on user's the computer. //$filename = $_FILES['attachment']['name']; if($_FILES['attachment']['type'] === 'image/jpeg' || $_FILES['attachment']['type'] === 'image/jpg' || $_FILES['attachment']['type'] === 'application/pdf') { //Move the file only if it's uploaded. if (is_uploaded_file($_FILES['attachment']['tmp_name'])) { //Whoops, an error. if (!move_uploaded_file($_FILES['attachment']['tmp_name'], './attachments/' . $_FILES['attachment']['name'])) { die('Error: File not uploaded. Please make sure it is a JPEG image or a PDF document.'); } else { $filename = $_FILES['attachment']['name']; } } } } if( $filename = '' || empty($_FILES['attachment'] )) { die('No attachment found. Please <a href="javascript: history.go(-1)">Go back</a>'); } if ($title === '') { die('News title is empty. Please <a href="javascript: history.go(-1)">Go back</a>'); } if ($content === '') { die('News content is empty. Please <a href="javascript: history.go(-1)">Go back</a>'); } else { if (mysql_query("INSERT INTO news (news_title, news_content, news_posted, news_edited, news_attach_path) VALUES ('$title', '$content', '$time', '0', '$filename')") or die(mysql_error())) { $posted = true; } else { $posted = false; } } ?> hey peeps, I am trying to get my site to display related youtube videos under the main video here is what i have $query=mysql_query("SELECT title,mp3ID,youtube_ID FROM songs ORDER BY RAND() LIMIT 10 ") or die("Error Occured"); $left = true; while($row=mysql_fetch_array($query)) { if ($left) { echo "<tr>"; } echo "<td align='justify' width='100%' cellspacing='2' cellpadding='2' >"; echo "<td><img src='http://img.youtube.com/vi/".$row['youtube_ID']."/default.jpg'></td>"; echo "<td nowrap><a href='/music.php?id=".$row['mp3ID']."'>".$row['title']."</a></td>"; echo"</td>"; if (!$left) { echo"</tr>"; } $left = !$left; } ?> this is basic info of how i am able to get youtube video titles and image....i want to use the same youtube.com video ID To get related videos please help!! Ok this should be straight forward but my tired brain cannot work this out. I'm creating a simple contact form and for some reason the validation isn't working. It wont go past the check fields are filled in validation. Can anyone spot what I'm doing wrong? Code: [Select] <form method="get"> <h1 class='contact_form_h'>Contact Us</h1> <div id="login_response"></div> <input type='text' name='name' id='name' class='contact_form_input' value='Name' onfocus="if(!this._haschanged){this.value=''};this._haschanged=true;" /> <input type='text' name='email' id='email' class='contact_form_input' value='Email' onfocus="if(!this._haschanged){this.value=''};this._haschanged=true;" /> <textarea name='enquiry' id='enquiry' class='contact_form_textarea' rows='10' cols='10' onfocus="if(!this._haschanged){this.value=''};this._haschanged=true;">Enquiry</textarea> <input type='submit' name='contact' id='contact' class='contact_form_submit' value='Contact Us' /> </form> Code: [Select] <?php //Check if form is submitted if(isset($_GET['contact'])) { //Require check email function require "check_email.php"; //Variables $err_name=stripslashes($_GET['name']); $err_email=stripslashes($_GET['email']); $err_enquiry=stripslashes($_GET['enquiry']); $to="xxx@xxxx.com"; $subject="Website Contact Form"; $from = stripslashes($_GET['name'])."<".stripslashes($_GET['email']).">"; $message = $err_enquiry; $headers = "From: $from\r\n" . "MIME-Version: 1.0\r\n" . "Content-Type: multipart/mixed;\r\n" . " boundary=\"{$mime_boundary}\""; //Check all form fields are filled in if ($_GET["name"]!='' OR $_GET["name"]!='Name' OR $_GET["email"]!='' OR $_GET["email"]!='Email' ) { if (isValidEmail($_GET['email'])){ //Send Mail if (@mail($to, $subject, $message, $headers)) { echo "3 - sent"; } else{ echo "2 - not"; } } else { echo "1 - not valid"; } } else { echo"0 - Fill in"; } } ?> Below is the check email script. Code: [Select] <?php // This function tests whether the email address is valid function isValidEmail($email){ $pattern = "^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$"; if (eregi($pattern, $email)){ return true; } else { return false; } } ?> Hi all, for some reason I cant see this blantantly obvious query. I have 3 rows in my database, all with an id of 1, their is a column called price which contains three different float values, how the hell do I write a query in php for this?! Code: [Select] $q = mysql_query("SELECT price FROM mytable WHERE id=1") ????Thanks! Okay guys. My brain has completely froze and I can't figure out how to do this. I have one date, that is somewhat static it doesn't change regularly but it changes. Anyway let's say this timestamp is: 2011-07-12 10:30:00 and the current timestamp is 2011-07-13 10:30:00 That's exactly a day difference, which will produce 86400 seconds. How would I write this in PHP? Code: [Select] <? $out = preg_replace('/^(.{701}[^.]*).*/i','$1.',$detrsltnewsrow[news_desc]); echo $out; ?> </td></tr><tr><td colspan="2" class="para" style="padding-left:10px;"> <?= substr(stripslashes(trim($detrsltnewsrow[news_desc])),701) ?> </td></tr> I have the above snippet.. The first php statement, basically grasp the first 701 characters with the closet next stop "." character and out puts it. then out puts the HTML tags I have a problem with the second statement. I want to output anything after what has been outputted by: Code: [Select] <? $out = preg_replace('/^(.{701}[^.]*).*/i','$1.',$detrsltnewsrow[news_desc]); echo $out; ?> So need the correct syntax for Code: [Select] <?= substr(stripslashes(trim($detrsltnewsrow[news_desc])),701) ?> Currently it breaks at exactly the 701 character, want it to continue from the sentence the first code ended in. Had a crack at making my own generator which makes some jumble 32 characters long with letters and numbers. In logic it seemed fine to me. It practice it just does nothing. function generate(){ $abc = array("a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"); $num = array("0", "1", "2", "3", "4", "5", "6", "7", "8", "9"); $result = ""; for ($i = 0; $i < 32; $i++){ $bool = rand(0,1); if ($bool = 1) { $result . $abc[rand(0,25)]; } else { $result . $num[rand(0,9)]; } } echo $result; } Hello Php Freaks I am following this tutorial how to make a login for my website, the only trouble is that... It dosen't seem to work, so i wanna know if its only me who cant make it work... and if it is why XD... Tutorial can be found he http://www.knowledgesutra.com/forums/topic/7887-php-simple-login-tutorial/ Now when i get started it starts saying error at line 6: if ($_GET["op"] == "login") It says that when im about to login right above the login. Now when i put in data i get error on line 19: $r = mysql_query($q); That one, and i have no idea how to fix it. Anyone please ? hello agen i got problem using login php in database i have stored passwords as *4D5FC004C2D5AE0B5513693AD1B271F8A2A92CEC (i think its hash inserted as password) case is that it dont read password :/ kinda strange, any help will be welcome Code: [Select] <? session_start(); if(isset($_GET['reg'])){ $reg=$_GET['reg']; }else{ $reg=""; } if($reg==1){ $msg1="<font color=\"#FF0000\"><b>Your details have been added, please login</b></font>"; }elseif($reg==2){ $msg1="<font color=\"#FF0000\"><b>You have been successfully logged out.</b></font>"; } if(isset($_POST['submit'])){ if( empty($_POST['uname']) && (empty($_POST['upass']))){ header( "Location:Messages.php?msg=1" ); exit(); } //transfer to shorter var $n=$_POST['uname']; $p=$_POST['upass']; //connect to db include('config.php'); $query="select * from user where uname='$n' and pw='$p' "; $result=mysql_query($query); $num=mysql_num_rows($result); if($num>0 ){ //put in session vars $mytime=time(); $mytime=date("H:i:s A",$mytime); $_SESSION['time'] = $mytime; $_SESSION['status'] = 'logged'; $_SESSION['username'] = $n; //goto next page header("location:welcome.php"); exit; }else{ $_SESSION['status'] = 'not logged'; header( "Location:Messages.php?msg=2" ); exit(); } } ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html><!-- InstanceBegin template="/Templates/Auth.dwt.php" codeOutsideHTMLIsLocked="false" --> <head> <!-- InstanceBeginEditable name="doctitle" --> <title>Login</title> <!-- InstanceEndEditable --> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <!-- InstanceBeginEditable name="head" --> <!-- InstanceEndEditable --> <link href="styleLog.css" rel="stylesheet" type="text/css"> </head> <body> <table width="100%" border="0" cellspacing="7" cellpadding="0"> <tr class="temptitle"> <td><!-- InstanceBeginEditable name="EditRegion4" -->Login<!-- InstanceEndEditable --></td> </tr> <tr> <td><!-- InstanceBeginEditable name="EditRegion3" --> <form name="form1" method="post" action="login.php"> <table width="81%" border="0" align="center" cellpadding="0" cellspacing="3"> <tr class="listtop"> <td colspan="3">Login Status:<? if(isset($msg1)){ echo "$msg1"; }?></td> </tr> <tr> <td width="9%">Username</td> <td width="41%"><input name="uname" type="text" id="uname" size="50"></td> </tr> <tr> <td>Password</td> <td><input name="upass" type="password" id="upass" size="50"></td> </tr> <tr> <td colspan="2"><div align="center"><a href="password.php">Forgotten your password?</a>|<a href="register.php">Register</a> </div></td> </tr> <tr> <td> </td> <td><input type="submit" name="submit" value="Login"></td> </tr> </table> </form> <!-- InstanceEndEditable --></td> </tr> <tr> <td><div align="center">Copyright 2005 </div></td> </tr> </table> </body> <!-- InstanceEnd --></html> Hi community. The radio buttons on my form suddenly stopped working. For the life of me I can’t figure out why. Everything seems to look fine. I did some moving around on servers so I wonder if something got messed up during the transfer. I’m wondering if a new version of PHP was installed and made something obsolete. I was wondering if someone could take a look. Thank you in advance for your advise.
<form action="brian_1.php" method="post" name="form1" id="form1"> <input name="name" type="text" id="name" size="30" tabindex="1"/> Company if Applicable: <input name="company" type="text" id="company" size="30" tabindex="2"/> Phone: <input name="phone" type="text" id="phone" tabindex="3" onkeypress="return formatPhone(event,this)" onkeydown="return getKey(event,this)" size="13" maxlength="12"/> Example: XXXXXXXXXX Alternate Phone: <input name="altphone" type="text" id="altphone" tabindex="4" onkeypress="return formatPhone(event,this)" onkeydown="return getKey(event,this)" size="13" maxlength="13"/> Example: XXXXXXXXXX Street Address:<input name="mail" type="text" id="mail" size="60" tabindex="5"/> City, State, Zip Code: <input name="city" type="text" id="city" size="60" tabindex="5"/> E-mail: <input name="emai" type="text" id="emai" size="60" tabindex="6"/> Would you like to be part of our mailing list? <label><input type="radio" name="list" value="Yes" id="RadioGroup1_0" tabindex="7"/>Yes</label><label><input type="radio" name="list" value="No" id="RadioGroup1_1" tabindex="8"/>No</label> Are you interested in volunteering for upcoming events? <label><input type="radio" name="volunteer" value="Yes" id="RadioGroup2_0" tabindex="9"/>Yes</label><label><input type="radio" name="volunteer" value="No" id="RadioGroup2_1" tabindex="10"/>No</label> Are you interested in becoming a sponsor by receiving opportunities to advertise through us? <label><input type="radio" name="opportunities" value="Yes" id="RadioGroup3_0" tabindex="11"/>Yes</label><label><input type="radio" name="opportunities" value="No" id="RadioGroup3_1" tabindex="12"/>No</label> Would you like to join our efforts by offering your services or products to further our cause? <label><input type="radio" name="cause" value="Yes" id="RadioGroup4_0" tabindex="15"/>Yes</label><label><input type="radio" name="cause" value="No" id="RadioGroup4_1" tabindex="16"/>No</label> If so, in what ways would you like to contribute? <textarea name="contribute" cols="60" rows="4"></textarea> <input type="submit" name="Submit" value="Sumbit" /><input type="reset" name="reset" id="reset" value="Clear" /> </form> <?php /* Email Variables */ $emailSubject = 'Contact Form'; $webMaster = 'brianewagnerfund@gmail.com'; $webMaster = 'matt@webskillsplus.com'; //$webMaster = 'murrterr@rcn.com'; /* Data Variables */ $name = $_POST['name']; $company = $_POST['company']; $phone = $_POST['phone']; $altphone = $_POST['altphone']; $mail = $_POST['mail']; $city = $_POST['city']; $emai = $_POST['emai']; if (isset($_POST["submit"])) { echo $_POST["list"]; } if (isset($_POST["submit"])) { echo $_POST["volunteer"]; } if (isset($_POST["submit"])) { echo $_POST["opportunities"]; } if (isset($_POST["submit"])) { echo $_POST["cause"]; } $contribute = $_POST['contribute']; $body = <<<EOD \r\n \r\n <br> Name(s): $name \r\n <br> Company if Applicable: $company \r\n <br> Phone: $phone \r\n <br> Alternate Phone: $altphone \r\n <br> Street Address: $mail \r\n <br> City, State, Zip Code: $city \r\n <br> Email: $emai \r\n <br> Would you like to be part of our mailing list? $list \r\n <br> Are you interested in volunteering for upcoming events? $volunteer \r\n <br> Are you interested in becoming a sponsor by receiving opportunities to advertise through us? $opportunities \r\n <br> Would you like to join our efforts by offering your services or products to further our cause? $cause \r\n <br> If so, in what ways would you like to contribute? $contribute \r\n <br> EOD; $from = "From: BrianEWagnerFund@gmail.com\r\n"; $from .= "Reply-To: ".$emai."\r\n"; $from .= "Content-type: text/html\r\n"; mail($webMaster, $emailSubject, $body, $from); /* Results rendered as HTML */ echo "<meta http-equiv=\"refresh\" content=\"0;URL=http://www.brianewagnerfund.org/thankyou.html\">"; ?> |