Jump to content

wildteen88

Staff Alumni
  • Posts

    10,480
  • Joined

  • Last visited

    Never

Everything posted by wildteen88

  1. wildteen88

    Defining

    Your only options is iframes by sounds of it.
  2. That is the working code. What errors are you getting. What bit are you confused about.
  3. Do you wantr to get rid of the limit parameter completly if so use this: [code]RewriteRule ^([A-Za-z0-9]+)/([0-9]+)/?$ index.php?page=$1&pagenum=$2 [L][/code] For your secound question, I'm not sure but prehaps this: [code]RewriteRule ^jack/([0-9]+)/$ jack$1.php[/code] by file name you mean jackx.php, x being a number?
  4. Try this as the query: SELECT * FROM " . TABLE_NAME . " WHERE `" . USER_NAME . "`='$userid' AND `" . PASS_NAME . "`='$password' AND `" . ACTIVATED_NAME . "`='1'"
  5. Add a semi-colon ( ; ) at the end of this line: [code=php:0]$opts = array("ucf","north","downtown","disney","citiwalk")[/code] So its: [code=php:0]$opts = array("ucf","north","downtown","disney","citiwalk");[/code] You should be fine now.
  6. Chnage this: [code]?> <?php foreach ( $results as $result ) { ?> <h1>Properties in <?php= $result['city'] ?>, <?php= $result['state']?></h1>[/code] To this: [code] echo '<h1>Properties in ' . $results['city'] . ', ' . $results['state'] . '</h1>'; foreach ( $results as $result ) { ?>[/code]
  7. What do you mean by predict a date. You can use strtotime function to get a furture dates timestamp and then convert that into a normal date: [code=php:0]<?php // get the timestamp of a date 3 days, 6 hours and 28 secounds from now $future_date_timestamp = strtotime("+3 days 6 hours 28 seconds"); echo "Future date timestamp: " . $future_date_timestamp . "<br /><br />\n\n"; // now we convert the furture dates timestamp into a readable date form $future_date = date("D jS M Y - h:i:s", $future_date_timestamp); echo "Furture date: " . $future_date; ?>[/code]
  8. What version of Apache have you got? I'm not sure why its not working. I'm new too to mod_rewrite however I use this on my one of my scripts I'm creating. Try it as just, do you get anything with that? [code]RewriteRule ^([a-zA-Z0-9]+)$ $1.html[/code] Also as this is more to do with mod_rewrite I'll move this to the Apache forum.
  9. You cannot change the buttons in the confirm dialog box. Unless you create your own custom popup window. For your secound question yes it can be done. However you'll have to get javascript to submit the form and add a url parameter called send and assign the value of 1 to it. Then in your PHP script you check whether the url has the send paramerter and is equal to 1, you send the email. If its not there is is not equal to 1 you dont send the email. I'll some code in a sec. Also this is more of a javascript question so I'll move this to the correct forum The html: [code]< script type="text/javascript" > // this function adds a url parameter which determins whether we send an email or not function sendForm() {     // this gets our form     // change yourFormName to the name of your form     // if your form doesnt have a name set add     // name="yourFormName" inside the form tag     var form = yourFormName;     // this variable holds TRUE if the user clicks OK or FALSE if the user clicks CANCEL.     var sendEmail = confirm('Click Ok to update database and send an email or Cancel to update database only');     // this si what adds the url parameter to the url     // if the user clicks OK the we added ?send=1 to the url     // if the user clicks CANCEL the we add send=0     // this url parameter will be used by PHP to determin whether to send an email     if(sendEmail) {         form.action = form.action + '?send=1';     } else {         form.action = form.action + '?send=0';     } } < /script > <form action="test.php" name="yourFormName" method="post">   Forname: <input type="text" name="name" /><br />   Surname: <input type="text" name="surname" /><br />   <input type="submit" name="btn_H_Submit" onclick="sendForm()" value="Enter Information" /> </form>[/code] Have a read of the comments above for more info on whats going one (the comments are the double backslashes(//)) The PHP code: [code]<?php // update the database here echo "Update the database here<br /><br /><br />"; // Remeber the send url parameter that gets set with the javascript. // This is where we determin whether to send an email! // This checks whether the send url parameter exists and it is equal to 1 // if it is we send the email. if(isset($_GET['send']) && $_GET['send'] == '1') {   // send email   echo 'send an email tooo!!!'; } ?>[/code]
  10. What OS is your server running on? If its windows [url=http://www.phpfreaks.com/forums/index.php/topic,95378.0.html]read this FAQ thread[/url] it shoud help you. If your server is running on a unix based system you'll need to recompile PHP with the [b][i]--with-mysql=path/to/mysql[/i][/b] command and read the installation sections over at [url=http://uk.php.net/manual/en/ref.mysql.php]php.net[/url] for enabling the mysql extensions on Unix based systems. (Linux/Unix/Mac)
  11. The only way for CSS to display an image is by using the background-image style attribute. There is no other CSS attributes that can display an image AFAIK. This is probably not a good idea to have but what you could do is have two image tags where one displays header1.gif and other displays header2.gif. Give them class names of header1 and header2 Now in the stylesheet you want to display header1.gif add this to it: [code].header1 {     display: block; /* this shows the image for header1 */ } .header2 {     display: none;  /*this stops the header2 image from displaying */ }[/code] For the style you want to display header2.gif you use this: [code].header1 {     display: none; /*this stops the header1 image from displaying */ } .header2 {     display: block; /* this shows the image for header2 */ }[/code] That way when the user switches stylesheet a different image will be shown for each style. However using the background-image attribute is probably better.
  12. Chnage this: [code]if (!mysqli_query($link, $insert)) {       $msg = "Error inserting data";     } else {[/code] to: [code]if (!mysqli_query($link, $insert)) {       $msg = "Error inserting data - " . mysqli_error($link);     } else {[/code] It should now show an error messge from MySQL with info on why it is failing. Post the error here if you dont know what it means.
  13. No problem. Glad we got there in the end. :)
  14. There is no file called php5_module that comes with PHP. The php5 module for apache is called [b]php5apache2.dll[/b] This line: [code]LoadModule php5_module "C:/php/php5apache2.dll"[/code] Sets up the php5 module. It tells Apache Where the module is. In your case the path to the module is C:/php/ and the module is php5apache2.dll
  15. Topic locked. Please don't double post.
  16. Chnage this: [code]setcookie( 'auth', 'ok' ); setcookie( 'userGroup', 'user' ); setcookie( 'name', $_POST['name'] );[/code] to: [code]if(isset($_POST['name'])) {     setcookie( 'auth', 'ok' );     setcookie( 'userGroup', 'user' );     setcookie( 'name', $_POST['name'] ); }[/code] Always check whether a POST var exists first before using it. Then you dont get the underfined index notice message. Also Why are you setting a cookie and a session with the same information? You might want to move the code above down to the bit where the user has successfully logged in. Otherwise if the user wasnt successfully logged in the unauthorised user is going get a cookie set.
  17. Remove the PHP tags as you are already in php mode: [code=php:0]$vv2 = 'variable2<input type="text" name="vars2" size="30" value="' . htmlspecialchars($var2) . '">';[/code] If you want to add a variable to a string use the concatenation operator (.) Is that what you want?
  18. I have IE7. SO i dont know what version of IE you have. But I increased the widths by 1px so they are even. All browsers displays correctly [code]<style> #menu {     width: 150px;     height: 300px;     border-right: 2px solid #999999;     border-bottom: 2px solid #999999;     border-left: 2px solid #999999;     background-color: #000000; } #menuwrap {     width: 156px;     height: 304px;     padding-left: 2px;     border-right: 1px solid #ff0000;     border-bottom: 1px solid #ff0000;     border-left: 1px solid #ff0000; } </style> <div id="menuwrap">   <div id="menu">Hello world</div> </div>[/code] I also got rid of the positioning too.
  19. The PHP module is in the root of the PHP zip file you ahve downloaded. Extract the contents of the zip to C:\PHP Now open the httpd.conf file for Apache And add this: [code]LoadModule php5_module "C:/php/php5apache2.dll[/code] Now download the Apache2.2.x php5 module from from [url=http://www.apachelounge.com/download/mods/php5apache2.dll-php5.1.x.zip]ApacheLounge.com[/url] Extract the contents of that zip to your My Documents area. Copy the php5apache2.dll file to C:\php overwritting the existing php5apache2.dll file. Now read the readme.txt file encloded in the zip file for more installation instructions. You're done!
  20. As you are doing the same thing over and over on each line of code. Use a foreach loop which will do all the hard work for you: [code=php:0]// get the id from the POST array. This will be used latter $id = mysql_real_escape_string($_POST['id']); // remove the id from $_POST array. As we dont need it any more. unset($_POST['id']); // now the fun starts! Put PHP into auto mode! foreach($_POST as $key => $value) {     $value = mysql_real_escape_string($value);     mysql_query("UPDATE contactbook SET " . $key . " = '" . $value . "' WHERE id='" . $id . "'"); }[/code] Thats it! NOTE in order for this code to work the form fields will have to have the same name as the name of the fields in your contactbook table.
  21. Regular expressions do look dawnting when you first have a look at them. However they become easier once you know the basics. [url=http://weblogtoolscollection.com/regex/regex.php]This site[/url] has a quick intro tutorial on regular expressions. Also you might want to check out [url=http://www.regular-expressions.info/]regular-expressions.info[/url] too which is a site dedicated to learning regular expressions.
  22. You get it from from PHP.net. NOTE: PHP 4 or 5 currently doesnt support Apache2.2.x You should get the Apache modules with the PHP distribution you download from php.net. You'll have to download php4apache2_2.dll or php5apache2_2.dll from Apache Lounge in  order to get PHP to wokr with Apache2.2.x. Or downgrade to Apache2.0.x NOTE if you are on a unix based system you'll want the .so files rather than .dll files.
  23. Did you restart Apache when you changed the php.ini. It is important you restart the server for the new PHP configuration to come available.
  24. @onlyican - That shouldnt matter with is_numeric. As it compares whether a variable is either a number or a number string. @sno - change my code snippet provided above to this: [code=php:0]if(isset($_GET['id']) && is_numeric($_GET['id'])) {     $id = $_GET['id']; } // id is not a number or is not set so we kill the script. else {     echo 'DEBUG INFO:<br /> <br /> id - ' . $_GET['id'] . '<br /> id is: ' . gettype($_GET['id']) . '<br /><br />'; }[/code] What do you get now?
  25. Um dont just post the code. What do you want? Please explain whats wrong with your script and what you are trying to do. Also post what the script is supposed to do. Edit the post above to add this in. When you post coder please use the code tags. ([ code][ /code] (without the spaces before [))
×
×
  • 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.