Jump to content

Johnnyboy123

Members
  • Posts

    65
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Johnnyboy123's Achievements

Member

Member (2/5)

0

Reputation

  1. So I'm starting this site for a small company and I'm already stuck lol. Basically, on my home page I have rollover images coded with javascript ( I used dreamweaver, so the coding was done auto by dreamweaver not by me) and then I also have an auto gallery, which plays by itself and automatically scrolls through images. The gallery is also coded in javascript. They both work perfectly fine, until they are put together on the same page. I have tested the page by either removing the gallery and leaving the rollover images, or vice versa, and they both work. However, when I use both on the same page, it seems only the rollover images work and the gallery doesn't display it's pictures at all. I'm assuming the code is conflicting with each other in some way, but my javascript is extremely rusty (hence using dreamweaver). Can anyone help me out? Here's my code, thanks in advance: <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> <SCRIPT LANGUAGE="JavaScript"> <!-- // image paths src = ["1.gif", "2.gif"] //duration for each image duration = 3; ads=[]; ct=0; function switchAd() { var n=(ct+1)%src.length; if (ads[n] && (ads[n].complete || ads[n].complete==null)) { document["Ad_Image"].src = ads[ct=n].src; } ads[n=(ct+1)%src.length] = new Image; ads[n].src = src[n]; setTimeout("switchAd()",duration*1000); } function doLink(){ location.href = url[ct]; } onload = function(){ if (document.images) switchAd(); } // end of auto gallery //start of rollover images function MM_preloadImages() { //v3.0 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array(); var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++) if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}} } function MM_swapImgRestore() { //v3.0 var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc; } function MM_findObj(n, d) { //v4.01 var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) { d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n]; for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); if(!x && d.getElementById) x=d.getElementById(n); return x; } function MM_swapImage() { //v3.0 var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3) if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];} } //--> </script> <style type="text/css"> body { background-image: url(); background-color: #000; } #apDiv1 { position:Relative; margin:0px auto; width:1024px; height:768px; z-index:1; } #apDiv2 { position:absolute; left:1022px; top:125px; width:2px; height:0px; z-index:2; } #apDiv3 { position:absolute; left:10px; top:312px; width:24px; height:33px; z-index:2; } #apDiv4 { position:absolute; left:58px; top:461px; width:334px; height:265px; z-index:2; } #apDiv5 { position:absolute; left:59px; top:237px; width:575px; height:161px; z-index:2; font-size: 16px; } #apDiv5 p { font-size: 36px; } #apDiv5 p { font-size: 28px; } #apDiv6 { position:absolute; left:447px; top:474px; width:263px; height:266px; z-index:3; font-size: 18px; text-align: justify; } #apDiv7 { position:absolute; left:825px; top:360px; width:153px; height:403px; z-index:2; } #apDiv5 p { font-size: 20px; text-align: justify; } .dd { text-align: center; } .ddd { text-align: justify; font-size: 18px; } #apDiv5 .dd .ddd { font-size: 20px; } .s { text-align: center; } #apDiv8 { position:absolute; left:176px; top:119px; width:157px; height:38px; z-index:4; } #apDiv9 { position:absolute; left:42px; top:188px; width:144px; height:45px; z-index:4; } #apDiv10 { position:absolute; left:183px; top:188px; width:144px; height:45px; z-index:2; } #apDiv11 { position:absolute; left:321px; top:188px; width:144px; height:45px; z-index:2; } #apDiv12 { position:absolute; left:456px; top:188px; width:144px; height:45px; z-index:3; } #apDiv13 { position:absolute; left:155px; top:81px; width:84px; height:37px; z-index:2; } #apDiv14 { position:absolute; left:42px; top:188px; width:144px; height:45px; z-index:2; } #apDiv15 { position:absolute; left:180px; top:188px; width:144px; height:45px; z-index:3; } #apDiv16 { position:absolute; left:319px; top:188px; width:144px; height:45px; z-index:4; } #apDiv17 { position:absolute; left:455px; top:188px; width:144px; height:45px; z-index:5; } #apDiv18 { position:absolute; left:78px; top:293px; width:718px; height:464px; z-index:2; } </style> </head> <body onload="MM_preloadImages('buttons/home.gif','buttons/gallery2.gif','buttons/products2.gif','buttons/contacts2.gif')"> <div id="apDiv1"><img src="background4.gif" width="1024" height="768" /> <!-- Gallery --> <div id="apDiv4"> <IMG NAME="Ad_Image" SRC="image1.gif" BORDER=0> </div> <div id="apDiv5"> <center> <b><p> Welcome to Jimmy's trailer Hire </p></b> </center> <p class="dd"><span class="ddd">Jimmy's Trailer Hire is a company specializing in trailer rentals and the selling of second hand vehicles and canopies. </span><span class="ddd">We have been in business for 17 years now and have established a respectfull and quality reputation in the area. We promise quality and professional service in every aspect of what we do. Please have a look through our website and enjoy your stay. </span></p> </div> <div id="apDiv6">The mission of Jimm'ys Trailer Hire is to provide a means to the need of a way of transportation to the market. We aim to give our best quality service and expand the company over time. Customer satisfaction is our prime concern. We strive to give our customers good quality service.</div> <!-- Buttons --> <div id="apDiv14"><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image3','','buttons/home.gif',1)"><img src="buttons/hom1.gif" name="Image3" width="143" height="38" border="0" id="Image3" /></a></div> <div id="apDiv15"><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image4','','buttons/gallery2.gif',1)"><img src="buttons/gallery.gif" name="Image4" width="144" height="38" border="0" id="Image4" /></a></div> <div id="apDiv16"><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image5','','buttons/products2.gif',1)"><img src="buttons/products.gif" name="Image5" width="143" height="38" border="0" id="Image5" /></a></div> <div id="apDiv17"><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image6','','buttons/contacts2.gif',1)"><img src="buttons/contacts.gif" name="Image6" width="143" height="38" border="0" id="Image6" /></a></div> <div id="apDiv7"> <form action="dummy" method="post"> <select style="font-size:11px;color:#000000;font-family:verdana;background-color:#f0f0df;" name="choice" size="1" onChange="jump(this.form)"> <option value="">Choose a Link</option> <option value="http://www.cnet.com">Cnet</option> <option value="http://www.download.com">Downloads</option> <option value="">- - - - - - - - - -</option> <option value="http://www.apple.com">Apple</option> <option value="http://www.microsoft.com">Microsoft</option> </select></form> <p> </div> </div> </body> </html> Apologies, I couldn't get the code to post in color, pardon my noobness.
  2. Hey guys, sorry I know this is a question that has been asked alot, but after googling for solutions I still haven't solved it. Basicly my situation is, I copied my php files from my pc to my laptop. On my pc I used easyphp and on my laptop I use XAMPP. Now all the code is untouched so what works on my pc should work on my laptop. All works fine except I get a header error when running the code from my laptop using XAMPP. Heres the error: Warning: Cannot modify header information - headers already sent by (output starter at C:\xampp\htdocs\test\includes\functions.php:3) in C:\xampp\htdocs\test\editsuccess.php on line 17. Heres my code: <?php include 'includes/config.php'; include 'includes/functions.php'; connect(); if(isset($_POST['submit'])) { $u = "UPDATE course SET `cname` = '$_POST[cname]' WHERE cid = $_POST[cid]"; mysql_query($u) or die(mysql_error()); header( "refresh:5;course_man.php" ); echo 'Update <b> successful </b> You\'ll be redirected in about 5 secs. If not, click <a href="course_man.php">here</a>.'; } ?> Like I said I don't see a white space problem, unless I'm missing it. Also as for the error message, I don't recall using any header functions from my functions.php file so I dont know why it's referring to that. I also tried using a strange function obs_in() at the beginning and obs_flush() or something like that, at the end of my code which someone recommends. It took care of the error message but didn't redirect the page. Could this have anything to do with the difference of using it on easyphp and xampp, maybe a php.ini setting? Any help would be greatly appreciated. Thanks in advance.
  3. As a beginner I am only fairly familiar with php and mysql. I will continue to try and improve on them. However, I would just like to know from you all what you think would be some other good languages to learn as a web developer? I am currently thinking: php & mysql, javascript, perl, and ruby? what would you say?
  4. Hey guys. Well I'm studying php and some other languages at the moment. The college I'm at is pathetic to say the least and to be honest I doubt I'm going to learn much through it, even though it is a web development course. I am trying to further myself as much as possible with self studying. I have 2 questions. 1. If you enter a job as a basic php developer. What are the basics that you would be able to do? Like what are common expectations that today's companies have for junior php developers in order to hire them? 2. What self study websites would you recommend? I am also looking for a good self study site that can teach me the fundamentals of database theory, their different relations and sql etc. As I did a short course on php before knowing any database theory, it was rather difficult for me haha. I just really need to figure out a way to become a decent php developer in today's world and as I mentioned the college I am at is a total rip and honestly I don't think anyone in my class, including myself, will be able to get a job if we only rely on what we we're taught at that shit hole. Any advice would be greatly appreciated
  5. Had to hand in project ran outta time hehe but made more progress than I thought. Thanks for the help.
  6. Your code had a few errors, however your comments and code logic made me look at my code more and change it up a bit. Everything is working fine now. If else statement is correct, it displays the variebles in the else statement and in the mail_body2. My only problem now is, instead of displaying all the students in the mail_body2 with a contact of "Y". It's only displaying 1 (assuming the first 1) I got these results after putting it in a while loop ( first attempt I got 200 emails haha ) how can I change this so it will not just display the first student in my table but all of them? <?php function sendmail(){ set_time_limit(60); $cname = mysql_real_escape_string($_POST['cname']); $sname = mysql_real_escape_string($_POST['sname']); $fname = mysql_real_escape_string($_POST['fname']); $contact = mysql_real_escape_string($_POST['contact']); $Name = "Student Course Registration"; //senders name $email = "goldie@telkomsa.net"; //senders e-mail adress $recipient = ($_POST['email']); //recipient $mail_body = "Congratulations $fname $sname. You have successfully registered for the following course: $cname "; //mail body $subject = "Course registration successful!"; //subject $header = "From: ". $Name . " <" . $email . ">\r\n"; //optional headerfields if ($contact=="Y"){ $contactstudents = "SELECT sname,fname,email FROM student WHERE contact_flag ='$contact'"; $run = mysql_query($contactstudents) or die(mysql_error()); while ($found = mysql_fetch_array($run)){ $contactemail=$found['email']; $contactsname=$found['sname']; $contactfname=$found['fname']; $studentlist ="$contactsname $contactfname $contactemail"; } { $mail_body2 = "Congratulations $fname $sname. You have successfully registered for the following course: $cname. Here is a list of all the students who you may be in contact with: $studentlist "; //mail body for contact flag mail($recipient, $subject, $mail_body2, $header); } } else { mail($recipient, $subject, $mail_body, $header); } } ?> Sorry I'm not completely using your code. Project is based on the way I coded it and will be looked at closely. Also for my own education I would like to find the errors in and correct my code. Thanks for your help.
  7. Would really appreciate it if someone helps. This is a project due for some time tomorrow and this is pretty much the only thing I have left to sort out. Thanks in advance.
  8. Doesn't quite seem to be working, or just me haha. But however in there was a few errors on my part in the previous code that could have effected yours. In any case I just kept getting the else statement email, even when the echo confirmed that it was = Y. But my fault for providing you with such a faulty code thanks though I worked a bit more on my code. Maybe I can give you something more decent to work with haha. Basicly I got it down to getting the if else statement to work fine i.e if =y I get mail_body 2 email and else I get mail_body. My only problem is I cant get the fields in the mail_body_2 to display ( $contactsname, $contactfname, $contactemail) which is the list of other students who selected Y. Here is my new code: <?php function sendmail(){ $cname = mysql_real_escape_string($_POST['cname']); $sname = mysql_real_escape_string($_POST['sname']); $fname = mysql_real_escape_string($_POST['fname']); $contact = mysql_real_escape_string($_POST['contact']); $Name = "Student Course Registration"; //senders name $email = "goldie@telkomsa.net"; //senders e-mail adress $recipient = ($_POST['email']); //recipient $mail_body = "Congratulations $fname $sname. You have successfully registered for the following course: $cname "; //mail body $subject = "Course registration successful!"; //subject $header = "From: ". $Name . " <" . $email . ">\r\n"; //optional headerfields if ($contact=="Y"){ $contactstudents = "SELECT contact_flag FROM student WHERE contact_flag ='$contact'"; $runcontact = mysql_query($contactstudents); $query = "SELECT sname,fname,email FROM student WHERE '$contact' = '$runcontact'"; $run = mysql_query($query) or die(mysql_error()); $found = mysql_fetch_array($run); $contactemail=$found['email']; $contactsname=$found['sname']; $contactfname=$found['fname']; $mail_body2 = "Congratulations $fname $sname. You have successfully registered for the following course: $cname. Here is a list of all the students who you may be in contact with: $contactsname, $contactfname, $contactemail"; //mail body for contact flag { mail($recipient, $subject, $mail_body2, $header); } } else { mail($recipient, $subject, $mail_body, $header); } } ?> It's like 3am here and my php skills is fairly poor so expect a few questionable mistakes . Thanks
  9. Changed the code up a bit, think I fixed a few things, though still getting the same results. But hope I made it easier to work off. <?php function sendmail(){ $cname = mysql_real_escape_string($_POST['cname']); $sname = mysql_real_escape_string($_POST['sname']); $fname = mysql_real_escape_string($_POST['fname']); $contact = mysql_real_escape_string($_POST['contact']); $contactstudents = "SELECT contact_flag FROM student"; $runcontact = mysql_query($contactstudents); $Name = "Student Course Registration"; //senders name $email = "goldie@telkomsa.net"; //senders e-mail adress $recipient = ($_POST['email']); //recipient $mail_body = "Congratulations $fname $sname. You have successfully registered for the following course: $cname "; //mail body $subject = "Course registration successful!"; //subject $header = "From: ". $Name . " <" . $email . ">\r\n"; //optional headerfields if ($contact=="y"){ $query = "SELECT sname,fname,email FROM student WHERE $contact = $runcontact"; $run = mysql_query($query) or die(mysql_error()); while ($found = mysql_fetch_array($run)) $contactemail=$found['email']; $contactsname=$found['sname']; $contactfname=$found['fname']; $mail_body2 = "Congratulations $fname $sname. You have successfully registered for the following course: $cname. Here is a list of all the students who you may be in contact with: $contactsname, $contactfname, $contactemail"; //mail body for contact flag { mail($recipient, $subject, $mail_body2, $header); } } else { mail($recipient, $subject, $mail_body, $header); } } ?> Can anyone point me in the right direction please?
  10. Well this is pretty much the first time I'm attempting something new without a tutorial aiding me ( I know your gonna think I probably should have used 1 when checking my code ) Honestly my brain is fried, but I have a deadline for tomorrow. Basicly I'm sending an email upon registration ( email sends fine ) I made it so the email display the students name and course. However in my registration a student can select contact y or n, which determines whether the student wants to be contacted by other students. So when sending an email to a student who selected n for contact, is should only display the students name and course (sname, fname, cname). However, for a student who selected y for contact, it should display the name and course aswell of a list display the sname,fname and email of all the other students in my student table who selected y in their contact_flag field. Here is my misguided code: <?php function sendmail(){ $cname = mysql_real_escape_string($_POST['cname']); $sname = mysql_real_escape_string($_POST['sname']); $fname = mysql_real_escape_string($_POST['fname']); $contact = mysql_real_escape_string($_POST['contact']); $Name = "Student Course Registration"; //senders name $email = "goldie@telkomsa.net"; //senders e-mail adress $recipient = ($_POST['email']); //recipient $mail_body = "Congratulations $fname $sname. You have successfully registered for the following course: $cname "; //mail body $subject = "Course registration successful!"; //subject $header = "From: ". $Name . " <" . $email . ">\r\n"; //optional headerfields if ($contact=='y'){ $query = "SELECT sname,fname,email FROM student WHERE $contact = ['contact_flag'] "; $run = mysql_query($query) or die(mysql_error()); $found = mysql_fetch_array($run); while ($found = mysql_fetch_array($run)) $contactemail=$person['email']; $contactsname=$person['sname']; $contactfname=$person['fname']; $mail_body2 = "Congratulations $fname $sname. You have successfully registered for the following course: $cname. Here is a list of all the students who you may be in contact with: $contactsname, $contactfname, $contactemail"; //mail body for contact flag { mail($recipient, $subject, $mail_body2, $header); } } else { mail($recipient, $subject, $mail_body, $header); } } ?> I am not receiving any errors from it, and I'm receiving an email which displays $mail_body instead of $mail_body2 which is my else statement. Please, help would be appreciate. Thanks in advance.
  11. Arg nevermind forgot a . in my smtp details haha sending fine. Thanks alot for the help
  12. Thanks alot. After changing the smtp and port details I received this error: Warning: mail() [function.mail]: Failed to connect to mailserver at "my smtp details" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\Program Files\EasyPHP-5.3.3\www\Project\registerstudent.php on line 132 <?php if($result) { $row = mysql_fetch_assoc($result); $course_id = $row['cid']; // add the student to the course_student table $addCID = 'INSERT INTO course_student (cid, sno) VALUES(' . $row['cid'] . ', ' . $sno_id . ')'; mysql_query($addCID) or die('Error:' . mysql_error()); // send email $Name = "Da Duder"; //senders name $email = "goldie@telkomsa.net"; //senders e-mail adress $recipient = "jgoldie@telkomsa.net"; //recipient $mail_body = "The text for the mail..."; //mail body $subject = "Subject for reviever"; //subject $header = "From: ". $Name . " <" . $email . ">\r\n"; //optional headerfields ini_set('sendmail_from', 'goldie@telkomsa.net'); //Suggested by "Some Guy" mail($recipient, $subject, $mail_body, $header); //Line 132 } } } ?> What do I do now to correct this?
  13. I'm trying to send email with php for the first time. Trying to make it so that after a user registers he/she receives an email after submitting. I'm trying to send it from 1 comp with an email of goldie@telkomsa.net to another with an email of jgoldie@telkomsa.net (I just really want to test if it's sending email another before I get technical with the email) Should this code work, here is part of my code with the email section in it: <?php // query $sql = "INSERT INTO student (sno, sname, init, fname, title, msname, dob, sex, lang, idno, telh, telw, cel, fax, email, address, contact_flag ) VALUES ('', '$sname', '$init', '$fname', '$title', '$msname', '$dob', '$sex','$lang', '$idno', '$telh', '$telw', '$$cell', '$fax', '$email', '$address', '$contact')"; mysql_query($sql) or die('Error:' . mysql_error()); $sno_id = mysql_insert_id(); // get the cid $cname = mysql_real_escape_string($_POST['cname']); $getCID = "SELECT cid FROM course WHERE cname='$cname'"; $result = mysql_query($getCID); if($result) { $row = mysql_fetch_assoc($result); $course_id = $row['cid']; // add the student to the course_student table $addCID = 'INSERT INTO course_student (cid, sno) VALUES(' . $row['cid'] . ', ' . $sno_id . ')'; mysql_query($addCID) or die('Error:' . mysql_error()); // send email $Name = "Da Duder"; //senders name $email = "goldie@telkomsa.net"; //senders e-mail adress $recipient = "jgoldie@telkomsa.net"; //recipient $mail_body = "The text for the mail..."; //mail body $subject = "Subject for reviever"; //subject $header = "From: ". $Name . " <" . $email . ">\r\n"; //optional headerfields ini_set('sendmail_from', 'goldie@telkomsa.net'); //Suggested by "Some Guy" if (mail($recipient, $subject, $mail_body, $header)){ echo "mail has been sent"; //mail command } } header( "refresh:5;student_man.php" ); echo 'Registration <b> successful </b> You\'ll be redirected in about 5 secs. If not, click <a href="student_man.php">here</a>.'; } } ?> Email is under the "email section" comment based of what I found on google. I'm not getting any errors so I want to know if the email isn't going through because of my code or my smtp setting etc.
  14. Thanks guys, I adjusted it with the code that matthew provided, which cleared up all the notices. I used die(mysql_error()); to find the error. Seems the error is: 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 'fname,sno LIKE '%sdfgf%'' at line 1 which refers to: <?php if ($x==1) $construct = "sname,fname,sno LIKE '%{$search_each}%'"; else $construct .= " OR sname,fname,sno LIKE '%{$search_each}%'"; } ?> When I only use 1 field however e.g $construct = "sname LIKE '%{$search_each}%'"; It seems to work fine. The original tutorial from where I worked off also only used 1 field. I believe the tut was based on using entered info from only 1 field to find a student. However, I want to be able to use either any 1 of 3 fields: either sname,fname or sno. Any ideas?
  15. Can someone help me with my code. Used a tutorial as aid but still struggling. Basically I have a table called student. I created a search engine so that if a user searches for either the sname,fname or sno of a student then that student would appear. Apart from some notices I got it working and displaying students when searching for only their sname. Now, I want to be able to make it possible to find a student by searching either sname,fname or sno and I'm getting errors. Can anyone have a look at my code: <?php //get data $button = $_GET ['submit']; $search = $_GET ['search']; if (!$button) echo "You didn't submit a term."; else { if (strlen($search)<=0) echo "search term too short."; else { echo "You searched for <b>$search</b><hr size='1'>"; include 'includes/config.php'; include 'includes/functions.php'; connect(); //explode search term $search_exploded = explode(" ",$search); foreach($search_exploded as $search_each) { //construct query $x++; //Line 30 if ($x==1) $construct .= "sname,fname,sno LIKE '%$search_each%'"; //Line 32 else $construct .= "OR sname,fname,sno LIKE '%$search_each%'"; } $construct = "SELECT * FROM student WHERE $construct"; $run = mysql_query($construct); $foundnum = mysql_num_rows($run); //Line 44 if ($foundnum==0) echo "No results found."; else { echo"$foundnum results found!<p>"; while ($runrows = mysql_fetch_assoc($run)) { //get data $sname = $runrows['sname']; $fname = $runrows['title']; $sno = $runrows['sno']; echo " <b>$fname</b> $sname $sno"; } } } } ?> Errors:Notice: Undefined variable: x in C:\Program Files\EasyPHP-5.3.3\www\Project\search.php on line 30 Notice: Undefined variable: construct in C:\Program Files\EasyPHP-5.3.3\www\Project\search.php on line 32 Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in C:\Program Files\EasyPHP-5.3.3\www\Project\search.php on line 44 No results found. First time attempting this, so any tips on what I did wrong would be great. Thank you in advance.
×
×
  • 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.