Jump to content

robolist

Members
  • Posts

    20
  • Joined

  • Last visited

Everything posted by robolist

  1. I tired that, but it didnt work. Nothing worked when i put the event rule on top, in fact the site was all messed up. Thanks, that makes a lot of sense. Can you please advise me of the best solution? I've tried so many variations without any luck.
  2. I have successfully created my mod_rewrite rule to change all dynamic URLs on the top level of the site, but now i need to create a rule for a second level, and i think later down the line i might need a second, second level of rewrites. At the moment i have this RewriteEngine on RewriteCond %{SCRIPT_FILENAME} !-d RewriteCond %{SCRIPT_FILENAME} !-f RewriteRule ^(.+)$ index.php?subj=$1 And this helps to change /index.php?subj=home to /home as it does for all other pages such as /contact /about /events and so on. But now I have created sub pages under events and therefore need to change /events.php?event=event-name to events/event-name. But when i add another rule it messes up the whole site. What i tried to do is this RewriteEngine on RewriteCond %{SCRIPT_FILENAME} !-d RewriteCond %{SCRIPT_FILENAME} !-f RewriteRule ^(.+)$ index.php?subj=$1 RewriteRule ^events/(.+)$ event.php?event=$1 I've even tried it with [L] flags after the Rewrite rules, but nothing seems to work, I would really appreciate it if someone can show me the best way to do this as nothing seems to work. Many thanks in advance
  3. It worked a treat, thanks so much. Don't you just hate it when the obvious answer is right in front of you but you just can't see it? haha I should have thought of that in the first place Many thanks for your help Rob
  4. Cheers, I didn't notice there was a 'mod_rewrite' forum.
  5. I'm fairly new to developing sites with dynamically generated pages and have just built my first CMS. Currently all pages come off the index and are pulled from its ID number and their URLs are like this mydomain.com/directory/index.php?subj=1 Its still in production so i only have three pages; Home, Events and Contact. Each one is represented by ID 1, 2 and 3. I have managed to create an .htaccess file and have successfully changed the URL to mydomain.com/directory/1/ (although i think im going to remove that trailing slash). But what i really want to do is pull the page title (except for home which should come off the root) but i just cant seem to get my head around it. If anyone could point me in the right direction I would be very grateful. Basically I need the URL to look something like this mydomain.com/directory/contact At the moment my .htsccess file looks like this RewriteEngine on RewriteCond %{SCRIPT_FILENAME} !-d RewriteCond %{SCRIPT_FILENAME} !-f RewriteRule ^([a-zA-Z0-9]+)/$ index.php?subj=$1 Cheers
  6. Hi Altrozero, Yes well i did take it off line as soon as it didnt work and just replaced it with a simple php script to send me an email with the details... But of course i really want to try to work out how to start using the database.. I will try what you have suggested if that still fails i will consult a professional to write the code for me.. Thanks again for your kind advice...
  7. Hi there guys, I am very new to php and mySQL and i am currently working on a new site which I want to create a form where my sit visitors can leave their details so i can send them emails with future promotions... I have uploaded the files and when testing the form there doesnt seem to be any errors messages, but then when i go to my phpMyAdmin to check i it has worked. I can not see any of the information to which i ave entered from the form n the website.. I would be very grateful if somebody can please help me... the code for the php is as below.. Many many thanks in advance.. <?php $username="rdo10000_robin"; $password="mypassword"; $database="rdo10000_email"; mysql_connect(localhost,$username,$password); @mysql_select_db($database) or die( "Unable to select database"); mysql_query($query); $query = "INSERT INTO data1 VALUES ('$_POST[name]','$_POST[email]','$_POST[phone]','$_POST[country]','$_POST[age]')"; header('Location: fish.html'); mysql_close(); ?> I really hope some one can help, many thanks in advance
  8. OK... I hate to say but I have failed in my efforts... I tried to make an array out of the $data, and the $myError. Finally I separated the three errors by $myError = array('error1', 'error2', 'error3') --(example only)--- And then with the echo using 0,1 & 2. It kind of worked but instead all separate errors came up all together LOL... even when one was not an error... OMG I am going crazy trying to figure this out... I know once i see it i will kick myself... but please can you help me out?? many many thanks in advance...
  9. LOL... Good answer.. I shouldnt be so lazy... I should at least try... OK.. I will give it a go...
  10. Thanks for your help... I am very new to php and not really sure exactly how to fix this... I understand what you mean about using an array to determine the separate errors. But i just dont know how to implement it. Below is the entire code for my page... I would be ever so grateful if you could help me out... <?php /* Set e-mail recipient */ $myemail = "@gmail.com"; /* Check all form inputs using check_input function */ $name = check_input($_POST['name'], "Please enter your name"); $subject = "Message from Keeper Website"; $email = check_input($_POST['email'], "Please enter your email address"); $how_find = check_input($_POST['how']); $comments = check_input($_POST['comments'], "Please write your message"); /* If e-mail is not valid show error message */ if (!preg_match("/([\w\-]+\@[\w\-]+\.[\w\-]+)/", $email)) { show_error("E-mail address not valid"); } /* Let's prepare the message for the e-mail */ $message = "Hello, Your contact form has been submitted by: Name: $name E-mail: $email How did he/she find out about? $how_find Comments: $comments End of message "; /* Send the message using mail() function */ mail($myemail, $subject, $message); /* Redirect visitor to the thank you page */ header('Location: thanks.html'); exit(); /* Functions we used */ function check_input($data, $problem='') { $data = trim($data); $data = stripslashes($data); $data = htmlspecialchars($data); if ($problem && strlen($data) == 0) { show_error($problem); } return $data; } function show_error($myError) { ?> <html> <head> <title>Contact </title> <meta name="google-site-verification" content="0idS3GHHR3bAfMMatJ2XYirKyVSNBZzCfyFja-3690Y" /> <meta http-equiv="X-UA-Compatible" content="IE=8" /> <meta http-equiv="Content-type" content="text/html; charset=UTF-8" /> <meta name="description" content=." /> <meta name="keywords" content="" /> <meta name="author" content="com" /> <link rel="stylesheet" type="text/css" href="css/master.css"> <link rel="stylesheet" type="text/css" href="css/form.css"> <link rel="shortcut icon" href="favicon.ico" > <link rel="icon" type="image/gif" href="favicon1.gif" > <script type="text/javascript"> function setfocus() { document.contactform.name.focus(); } </script> </head> <body onLoad="setfocus()"> <div id="page-container"> <div id="navigation"> <ul> <li><a href="index.html"><span><b>Home</b></span></a></li> <li><a href="class.html"><span><b>Cooking Class</b></span></a></li> <li><a href="menu.html"><span><b>Our Menu</b></span></a></li> <li><a href="herbs.html"><span><b>Herbs</b></span></a></li> <li class="last"><a href="contact.html"><span><b>Contact Us</b></span></a></li> </ul> </div> <div id="content-menu"> <div id="contact"> <center> <h1>Contact </h1> <p>If you would like to recieve more information on our cooking class, menu or just need directions. <br> Please feel free to contact us using the form below.<br/> <b>For a map to find Restaurant, <a href="images/_map.png" onclick="centeredPopup(this.href,'myWindow','371','233','yes');return false">please click here</a></p></b> <form id="form3" action="contact.php" method="post" name="contactform"> <h3><span>Contact Us</span></h3> <fieldset><legend>Contact form</legend> <p class="first"> <label for="name">Name <b><?php echo $myError; ?></b></label> <input type="text" name="name" id="name" size="30" /> </p> <p> <label for="email">Email <b><?php echo $myError; ?></b></label> <input type="text" name="email" id="email" size="30" /> </p> <p> <label for="how">How did you find us?</label> <select name="how" width="50"> <option value=""> -- Please select -- </option> <option>Google</option> <option>Yahoo</option> <option>Link from a website</option> <option>Word of mouth</option> <option>Other</option> </select> </p> </fieldset> <fieldset class="last"> <p> <label for="comments">Message</label> <b><?php echo $myError; ?></b> <textarea name="comments" id="comments" cols="30" rows="10"></textarea> </p> </fieldset> <p class="submit"> <button type="submit">Send</button> </p> </form> <p> </div> </div> </div> <p align="center">Copyright &copy ------</p> <script language="javascript"> var popupWindow = null; function centeredPopup(url,winName,w,h,scroll){ LeftPosition = (screen.width) ? (screen.width-w)/2 : 0; TopPosition = (screen.height) ? (screen.height-h)/2 : 0; settings = 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable' popupWindow = window.open(url,winName,settings) } </script> </body> </html> <?php exit(); } ?>
  11. I am fairly new to php and am just about to finish my website with its contact page. It is all working fine and i am receiving the email with the relevant information submitted. But there are few tweeks i would like to make, so it appears more professional. 1. For the validation I have selected it to validate three fields, email, name and message. I have tested it but the error messages are not separated. I mean if only one mistake is made then the error message appears under all three fields. 2. When I receive the email from whoever filled in the form I would like for their email address to be in the 'reply' and 'from' field in my email. I would be very grateful if anybody can help me out on these two problems I am having. Below is the code that i am currently using. (Where the errors occur i place the following code <?php echo $myError; ?> ) The following is my entire php code, which my html form directs to... <?php /* Set e-mail recipient */ $myemail = "myemailaddress@gmail.com"; /* Check all form inputs using check_input function */ $name = check_input($_POST['name'], "Please enter your name"); $subject = "Message from Keeper Website"; $email = check_input($_POST['email'], "Please enter your email address"); $how_find = check_input($_POST['how']); $comments = check_input($_POST['comments'], "Please write your message"); /* If e-mail is not valid show error message */ if (!preg_match("/([\w\-]+\@[\w\-]+\.[\w\-]+)/", $email)) { show_error("E-mail address not valid"); } /* Let's prepare the message for the e-mail */ $message = "Hello, Your contact form has been submitted by: Name: $name E-mail: $email How did he/she find out about us? $how_find Comments: $comments End of message "; /* Send the message using mail() function */ mail($myemail, $subject, $message); /* Redirect visitor to the thank you page */ header('Location: thanks.html'); exit(); /* Functions we used */ function check_input($data, $problem='') { $data = trim($data); $data = stripslashes($data); $data = htmlspecialchars($data); if ($problem && strlen($data) == 0) { show_error($problem); } return $data; } function show_error($myError) { ?> Many thanks in advance
  12. Dear all concerned, I would like to thank each and every one of you who have so kindly given me your time and knowledge in helping me with my contact form. Thanks to all of you it is now finally complete and in working order. Please feel free to browse through my website and give me your professional opinions on my design and content. All comments are much appreciated. http://www.rdosolutions.com Many thanks Rob
  13. Hi Pikachu, Thanks for the advice on that. But I have no idea how to do what you just said.. hahaha.. So sorry but I am very novice with php... do you think you would be able to just give me the code for that? I would be very grateful. Cheers Rob
  14. One more thing actually.. If i want to direct it to one of my pages if processed successfully of not. so i would design another two pages for this.. but what code do i use? many thanks n advance.. rob
  15. Hey guys thanks so much for all your help... jcbones thank you so much... you have solved my problem... yes i am sure i will need validation at some point but my site doesnt get so many visiters just yet.. thanks again for all your help...
  16. Thanks guys.. yeah i just want a very simple php script.. no need for validation or anything.. here is my form <form id="myform" action="send_contact.php" method="post" enctype="multipart/form-data"> <div> <div class="field"> <label for="name" >Name</label> <input class="inputfield textfield" name="name" type="text" /> </div> <div class="field"> <label for="customer_mail" >E-mail</label> <input class="inputfield textfield" name="customer_mail" type="text" /> </div> <div class="field"> <label for="website" >Website</label> <input class="inputfield textfield" name="website" type="text" /> </div> <div class="field area"> <label for="detail" >Details</label> <textarea class="inputfield textarea1" name="detail" ></textarea> </div> </div> <!--div class="clear"></div--> <input class="submitbutton" type="submit" value="Submit" name="Submit"/> </form> and again here is my script <?php // Contact subject $subject ="Website enquiry"; // Details $message=$_POST[detail]; // Mail of sender $mail_from=$_POST[customer_mail]; // From $header="from: $name <$mail_from>"; // Enter your email address $to ='robin@rdosolutions.com'; $send_contact=mail($to,$subject,$message,$header); // Check, if message sent to your email // display message "We've recived your information" if($send_contact){ echo "We've recived your contact information"; } else { echo "ERROR"; } ?> as i said it s working except the name doesnt get sent and i also want to add the website field.. thanks in advance..
  17. Hey guys, I really hope someone can help me out here. I have been working on my new website all week and am now almost finished. Just need to complete the contact page and touch up a few things... I really dont know php at all to be honest and just found a code somewhere on the net to help me. Heres my problem I have finally got the form to work but i am not recieving the correct data. I only get the email add, subject and messge. I am not getting the name of the sender.. also i really want to add a website field to the code because i do have that on the contact form... please can someone tell me where i am going wrong? the following is the php code i am using... <?php // Contact subject $subject ="Website enquiry"; // Details $message=$_POST[detail]; // Mail of sender $mail_from=$_POST[customer_mail]; // From $header="from: $name <$mail_from>"; // Enter your email address $to ='robin@rdosolutions.com'; $send_contact=mail($to,$subject,$message,$header); // Check, if message sent to your email // display message "We've recived your information" if($send_contact){ echo "We've recived your contact information"; } else { echo "ERROR"; } ?> please help me.. i am hoping to put the site live tomorrow... many thanks in advance.. rob
×
×
  • 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.