Jump to content

MP145

Members
  • Posts

    42
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Male

MP145's Achievements

Member

Member (2/5)

0

Reputation

  1. Thanks cooldude832. Everything works like a charm now regards,
  2. You can try removing the caps <HTML> tag on member-profile.php. You already have a tag above that line. <html xmlns="http://www.w3.org/1999/xhtml"> <HTML> // you can remove this. and also try adding <?php session_start(); ?> on top of your member-profile.php page Ex: <?php session_start(); ?> <!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=iso-8859-1" /> <title>Strike A Style.com - My Profile</title> Try it out. Regards,
  3. ;D Works like a charm... cooldude832 : How should i do it then? Now, i got to crack my head, to make it work on the drop down list, checkbox and radio button Thanks.
  4. Thank you very much haku & cooldude832, I kinda used both your advice. this is what i did: <?php if(!$mail->Send()) { echo "<div class=\"errorbox\">"; echo "Message could not be sent.<br />"; echo "Mailer Error: " . $mail->ErrorInfo; echo "</div>"; exit; } echo "<div class=\"noerrorbox\">"; echo "Thank You ".$RepName." . Your Message has been sent.<br />We will contact you ASAP."; echo "</div>"; } else { echo "<div class=\"errorbox\">"; echo $errors[0]; echo "</div>"; $inputs = array(); // cooldude832 method foreach($_POST as $key=>$value){ $inputs[$key] = $value; } } } ?> and at the form code: <input type="text" id="user" name="name" value="<?php if (isset($_POST['Submit'])) if (count($errors) != 0) {echo $inputs['name'];} // haku & cooldude832 method ?>" size="30" /> After testing it locally, it works fine for the first 2 error, because the 3rd error checks for checkdnsrr() , i need to upload it to a server. Will post the results soon, because i don't know what the outcome would be. Thanks guys.
  5. Hi guys, I'm not really sure how to title this but here goes... My PHP code: <?php function validate_email($email){ $exp = "^[a-z\'0-9]+([._-][a-z\'0-9]+)*@([a-z0-9]+([._-][a-z0-9]+))+$"; if(eregi($exp,$email)){ if(checkdnsrr(array_pop(explode("@",$email)),"MX")){ return true; }else{ return false; } }else{ return false; } } if (isset($_POST['Submit'])) { if (empty($_POST['name'])) { $errors[] = 'Please enter your name.'; } else if (!ereg("^[a-zA-Z ]+$",$_POST['name'])) { $errors[] = 'Please enter your name with alphabets only.'; } if (empty($_POST['email'])) { $errors[] = 'Please enter your e-mail address'; } else if (!validate_email($_POST['email'])) { $errors[] = 'Please enter a valid e-mail address'; } if (empty($_POST['country'])) { $errors[] = 'Please enter your country name.'; } if (empty($_POST['telephone'])) { $errors[] = 'Please enter your telephone no. Please enter 0 if you do not wish to provide a telephone no.'; } else if (!is_numeric($_POST['telephone'])) { $errors[] = 'Please enter a valid telephone with a numeric value without any dash or brackets'; } if (empty($_POST['message'])) { $errors[] = 'Please enter your message'; } else if (strlen ($_POST['message']) > 255) { $errors[] = 'Your message is too long, please do not submit more than 255 characters'; } if (empty($_POST['spam'])) { $errors[] = 'Please answer the basic math question'; } else if ($_POST['spam'] != 9) { $errors[] = 'Please enter the correct answer'; } if (count($errors) == 0) { function check_input($data) { $data = trim($data); $data = stripslashes($data); $data = htmlspecialchars($data); return $data; } $RepName = check_input($_POST["name"]); $RepMail = trim($_POST["email"]); $RepCom = check_input($_POST["message"]); require("./mail/class.phpmailer.php"); $mail = new PHPMailer(); //$mail->IsSMTP(); $mail->Host = "xxx"; //$mail->SMTPAuth = true; //$mail->Username = ""; //$mail->Password = ""; $mail->From = "$RepMail"; $mail->FromName = "$RepName"; $mail->AddAddress("xxx", "xxx"); $mail->AddReplyTo("$RepMail", "$RepName"); $mail->IsHTML(true); $mail->Subject = "xxx- $RepSubj"; $mail->Body = "xxx"; $mail->WordWrap = 50; if(!$mail->Send()) { echo "<div class=\"errorbox\">"; echo "Message could not be sent.<br />"; echo "Mailer Error: " . $mail->ErrorInfo; echo "</div>"; exit; } echo "<div class=\"noerrorbox\">"; echo "Thank You ".$RepName." . Your Message has been sent.<br />We will contact you ASAP."; echo "</div>"; } else { echo "<div class=\"errorbox\">"; echo $errors[0]; echo "</div>"; } } ?> // Part of the contact from <form action="" method="post" class="feedbackform"> <fieldset> <legend>CONTACT INFORMATION</legend> <div class="fieldwrapper"> <label for="name" class="styled">Your Name:</label> <div class="thefield"> <input type="text" id="user" name="name" value="<?php echo @$_POST['name']; ?>" size="30" /> </div> </div> Note: There are html codes above the php tags. I have a contact form with validation and use phpMailer to send the email. The form and the error messages kinda works but i would like to know, how do i display the input text value in the text box from the $POST value like name, email and etc before the actual form is emailed. At the moment, the form checks for any error in the name field and if there is no error it proceeds to the email field and the rest of error process goes on. I need to know the method to display the name field in the input text from the $POST value if there is no error. I tried <input type="text" id="user" name="name" value="<?php echo @$_POST['name']; ?>" size="30" /> but im kinda lost on how to erase the value once the email is sent. This method displays all the value even after the email is sent. Should session be used or is there a better way? Thanks.
  6. Brilliant!!! Thank you very much for the reply phparray Apparently the holly hack doesn't work, so had to load a diff css file with conditional statement. This is my working code now : Separate Css from the one above fieldset { position: relative; margin-top:3em; padding-top:2em; } legend{ position:absolute; top: -1em; left: .5em; } on the html page <link href="formstyle.css" rel="stylesheet" type="text/css" /> <!–-[if gt IE 6]> <link href="formstyleie.css" rel="stylesheet" type="text/css" /> <![endif]–-> and it works. As Matt would have said again "Voila!!!"
  7. Hi guys, I have set a background color to my fieldset in a form. It works like a charm in FF3.05, but on IE7 the background color extends above the fieldset border. Can this be rectified ? Here is my code : Css: fieldset { border: 1px solid #313325; background-color: #cbcbcb; padding: 10px; margin-bottom: 20px; } legend { color: #fff; background: #313325; border: 1px solid #4d4f40; padding: 2px 6px; } Html: <fieldset> <legend>CONTACT INFORMATION</legend> <div class="fieldwrapper"> <label for="name" class="styled">Your Name:</label> <div class="thefield"> <input type="text" id="name" value="" size="30" /> </div> </div> </fieldset> Thanks.
  8. Thank you premiso for the reply YESSSSSSSSSS, works like a charm!!! Thank you so so much.
  9. Hi guys, This is my code <?php //Connects to Database mysql_connect($dbhost,$dbuser,$dbpass) or die("Error:: can't connect to database"); $db = mysql_select_db("$dbname") or die("Unable to select db"); //Retrieves data from MySQL $data = mysql_query("SELECT * FROM botmenu ORDER BY id") or die(mysql_error()); $num=mysql_numrows($data); if ($num==0) { echo "Check Back Soon"; } else { //Puts it into an array while($bminfo = mysql_fetch_array( $data )) { //Displays the record echo '<a href="'.$bminfo['linkurl'].'">'.$bminfo['linktitle'].'</a> :: ';//Note two dots that i need to display } } ?> What this displays is : What i intend to do is : I would like to remove the :: from the last record in the mySql db. Can this be done in PHP ? Thanks
  10. Thanks SammyP for the reply. I made some changes and it's all good. Thanks for pointing out the <?php $pagename = $_SERVER["REQUEST_URI"]; $parts = Explode('/', $pagename); $npage = $parts[count($parts) - 1]; mysql_connect($dbhost,$dbuser,$dbpass) or die("Error:: can't connect to database".mysql_error()); $db5 = mysql_select_db("$dbname") or die("Unable to select db"); $result=mysql_query("Select * from pageview where namapage='$npage'") or die(mysql_error()); if (mysql_num_rows($result)==0){ mysql_query("insert into pageview (namapage,hits) values ('$npage','1')"); } $result1=mysql_query("Select * from pageview where namapage='$npage'") or die(mysql_error()); $pinfo = mysql_fetch_array( $result1 ); $count=$pinfo['hits']; $count=$count + 1; mysql_query ("update pageview set hits=$count where namapage='$npage'"); $vpage=$count; ?>
  11. ok, sorry. It was my mistake..it was the while loop after all. Changed it to : <?php $pagename = $_SERVER["REQUEST_URI"]; $parts = Explode('/', $pagename); $npage = $parts[count($parts) - 1]; mysql_connect($dbhost,$dbuser,$dbpass) or die("Error:: can't connect to database".mysql_error()); $db5 = mysql_select_db("$dbname") or die("Unable to select db"); $result=mysql_query("Select * from pageview where namapage='$npage'") or die(mysql_error()); if (mysql_num_rows($result)==0){ mysql_query("insert into pageview (namapage,hits) values ('$npage','1')"); } $pinfo = mysql_fetch_array( $result ); $count=$pinfo['hits']; $count=$count + 1; mysql_query ("update pageview set hits='$count' where namapage='$npage'"); $vpage=$count; ?>
  12. Hi guys, I have this simple page view counter in php that stores the page name into mysql table and displays the no of times the page has been viewed. When the page is called the first time, i get this but the initial line of code for the if result==0 insert value works, but it's not displaying. Is it because of the while loop? And when i refresh the page or call it the second time it displays the data. How can i rectify this? and do let me know if there are better or simpler way to code this. <?php $pagename = $_SERVER["REQUEST_URI"]; $parts = Explode('/', $pagename); $npage = $parts[count($parts) - 1]; mysql_connect($dbhost,$dbuser,$dbpass) or die("Error:: can't connect to database".mysql_error()); $db5 = mysql_select_db("$dbname") or die("Unable to select db"); $result=mysql_query("Select * from pageview where namapage='$npage'") or die(mysql_error()); if (mysql_num_rows($result)==0){ mysql_query("insert into pageview (namapage,hits) values ('$npage','1')"); } while($pinfo = mysql_fetch_array( $result )) { $count=$pinfo['hits']; $count=$count + 1; mysql_query ("update pageview set hits='$count' where namapage='$npage'"); $vpage=$count; // will echo this on the designated area (Line 107) } ?> Thanks.
  13. Thanks redarrow for the reply What i wanted to accomplish here is : to display the data from the table ppricing which is all in a single row for the variable $newd . passed on in the url blahblah.com/blah.php?package=blah <?php $id = $_GET['package']; $newd=base64_decode($id); ?> but the data in the table pdetails has multiple rows, so when i use this mysql select statement <?php $data = mysql_query("SELECT * FROM ppricing,pdetails WHERE ppricing.ptitle = '$newd' AND pdetails.pktitle = '$newd'") or die(mysql_error()); $num=mysql_numrows($data); if ($num==0) { echo "Check Back Soon"; } else { while($prinfo = mysql_fetch_array( $data )) { // Data from table ppricing // Data from table pdetails // Continue data from table ppricing } } ?> It loops the data in the ppricing table which is supposed to be single row. I need it to display the data from table ppricing then loop the data in pdetails and continue displaying the data in ppricing vbnullchar suggested to use inner.join, im not sure how to use that? On the other hand, im kinda thinking of letting it be, as now i got it working by splitting the queries. Do advice otherwise.
  14. Thanks vbnullchar for the reply. I went around and split the queries like this : <?php if(isset($_GET['package'])){ $id = $_GET['package']; $newd=base64_decode($id); mysql_connect($dbhost,$dbuser,$dbpass) or die("Error:: can't connect to database".mysql_error()); $db = mysql_select_db("$dbname") or die("Unable to select db"); $data1 = mysql_query("SELECT * FROM ppricing WHERE ptitle = '$newd'") or die(mysql_error()); $data2 = mysql_query("SELECT * FROM pdetails WHERE pktitle = '$newd'") or die(mysql_error()); $num1=mysql_numrows($data1); $num2=mysql_numrows($data1); if ($num1==0) { echo "Check Back Soon"; } else { while($prinfo1 = mysql_fetch_array( $data1 )) { echo '<div id="pricinginc">'; echo '<div id="ptincl">'.$prinfo1['ptitle'].'</div>'; echo '<div id="ptincr">Start Price: '.$prinfo1['psprice'].'</div>'; echo '<div id="ptincra">End Price: '.$prinfo1['peprice'].'</div>'; echo '<div id="ptincl1">'; echo '<div class="prclist">'; echo '<ul>'; if ($num2==0) { echo "Check Back Soon"; } else { while($prinfo2 = mysql_fetch_array( $data2 )) { echo '<li>'.$prinfo2['listitem'].'</li>'; // Only here the result is multiple rows . The rest is single rows } } echo '</ul>'; echo '</div>'; echo '</div>'; echo '<div id="clear"><!-- --></div>'; echo '<div id="ptincl2">'.$prinfo1['psummary'].'</div>'; echo '<div id="ptincl2pic">'.$prinfo1['ppic'].'</div>'; echo '</div>'; } } } else { echo "Blah..blah..blah"; } ?> And got it doing what i intended to do in the first place. Yes, i can post the table structure, it is as follows : Table Name : ppricing Field Type id int(11) ptitle varchar(100) psprice varchar(100) peprice varchar(100) psummary mediumtext ppic varchar(100) Table Name : pdetails Field Type id int(11) pktitle varchar(100) listitem varchar(100) The value in ppricing->ptitle and pdetails->pktitle will be the same. Should i use inner.join?
  15. Hi guys, Im trying to display data from 2 tables using a single query. I'm not sure if this is the correct method but in 1-table 'ppricing' the data are all single row for the '$newd' variable where else in another table 'pdetails' there are multiple rows for the '$newd' variable. With the code below, it loops table 'ppricing' data multiple times. I just need the data from the table 'pdetails' to loop. Can this be done or do i need to run 2 seperate queries? Thank You. <?php if(isset($_GET['package'])){ $id = $_GET['package']; $newd=base64_decode($id); mysql_connect($dbhost,$dbuser,$dbpass) or die("Error:: can't connect to database".mysql_error()); $db = mysql_select_db("$dbname") or die("Unable to select db"); $data = mysql_query("SELECT * FROM ppricing,pdetails WHERE ppricing.ptitle = '$newd' AND pdetails.pktitle = '$newd'") or die(mysql_error()); $num=mysql_numrows($data); if ($num==0) { echo "Check Back Soon"; } else { while($prinfo = mysql_fetch_array( $data )) { echo '<div id="pricinginc">'; echo '<div id="ptincl">'.$prinfo['ptitle'].'</div>'; echo '<div id="ptincr">'.$prinfo['psprice'].'</div>'; echo '<div id="ptincra">'.$prinfo['peprice'].'</div>'; echo '<div id="ptincl1">'; echo '<div class="prclist">'; echo '<ul>'; echo '<li>'.$prinfo['listitem'].'</li>'; echo '</ul>'; echo '</div>'; echo '</div>'; echo '<div id="clear"><!-- --></div>'; echo '<div id="ptincl2">'.$prinfo['psummary'].'</div>'; echo '<div id="ptincl2pic">'.$prinfo['ppic'].'</div>'; echo '</div>'; } } } else { echo "Blah..blah..blah"; } ?>
×
×
  • 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.