Jump to content

9999

Members
  • Posts

    99
  • Joined

  • Last visited

    Never

Posts posted by 9999

  1. Could someone help me with these 2 lines.  Many thanks in advance!

     

     

     

            if(!eregi("^[a-z0-9\._-]+@+[a-z0-9\._-]+\.+[a-z]{2,3}$", $_POST['email'])) { 
    
    
              if(!eregi("^[a-z0-9\._-]+@+[a-z0-9\._-]+\.+[a-z]{2,3}$", $value)) { 
    

  2. Given this script:

     

    <?php
    $file = file('info.txt');
    $statelist = array (1=> "California", "Florida", "Illinois", "New York", "Texas");
    foreach ($file as $line => $data)
    {
    list($state, $abbrev, $population) = explode('|', trim($data));
    for ($x=1; $x<5; $x++) {
        		if ($statelist[$x] == $state) {
    		echo $state . ", " . $abbrev . " - " . $population . '<br />';
    	}
    }	
    }
    ?>

     

    and this flat file (info.txt):

     

    California|CA|36,756,666
    Texas|TX|24,326,974
    New York|NY|19,490,297
    Florida|FL|18,328,340
    Illinois|IL|12,901,563

     

     

    This is what is outputted:

    California, CA - 36,756,666
    Texas, TX - 24,326,974
    New York, NY - 19,490,297
    Florida, FL - 18,328,340
    Illinois, IL - 12,901,563

     

    How can I sort the output by the index value of the "statelist array" so get this output:

    California, CA - 36,756,666
    Florida, FL - 18,328,340
    Illinois, IL - 12,901,563
    New York, NY - 19,490,297
    Texas, TX - 24,326,974

     

    Could  ksort($statelist) be implemented?

     

     

     

     

  3. I recently viewed this site: www.tinyurl.com/29k7x2z and was thinking about modeling a page based on its layout.  The layout shifts all over the place in IE6 and older while working fine in FF, Opera and even IE7. I'm thinking a couple of lines fix in the CSS might work.  Does anyone have ideas?

  4. Hello. Is there anything wrong with this snipet of code?  I want to run a query based on a condition set forth in the if-then statment.  The first two shown in all green work perfectly.  The second two don't work.

     

    $cat_id = $_GET['cat_id'];
    $state = $_GET['state'];
    
    if (($cat_id == "00") && ($state == "00")) {
    [color=green]$query = "SELECT name,address,city,state,zip,phone,web,other FROM ydc ORDER BY name ASC";[/color]
    } else if (($cat_id != "00") && ($state == "00")) {
    [color=green]$query = "SELECT name,address,city,state,zip,phone,web,other FROM ydc WHERE cat_id = $cat_id ORDER BY name ASC";[/color]
    } else if (($cat_id == "00") && ($state != "00")) {
    [color=red]$query = "SELECT name,address,city,state,zip,phone,web,other FROM ydc WHERE state = $state ORDER BY name ASC";[/color]
    } else {
    [color=red]$query = "SELECT name,address,city,state,zip,phone,web,other FROM ydc WHERE cat_id = $cat_id AND state = $state ORDER BY name ASC";[/color]
    }
    $result = mysql_query($query) or die('Sorry, could not get the listings at this time, please try later');
    if (mysql_num_rows($result) == 0) {
       echo "<h3>Sorry, there are no listings that match your selection.</h3>";
    } else {
          while($row=mysql_fetch_array($result, MYSQL_ASSOC))
          {
    $name = $row['name'];
    $address = $row['address'];
    $city = $row['city'];
    $state = $row['state'];
    $zip = $row['zip'];
    $phone = $row['phone'];
    $web = $row['web'];
    $other = $row['other'];
    echo "<h3>$name</h3>";
    echo "$address<br />";
    echo "$city, $state $zip<br />";
    echo "$phone<br />";
    echo "<a href=http://$web>Visit Website</a><br />";
    echo "$other";
    echo "<h2> </h2>";
          }
    }

  5. I link to a "tell a friend" or "share page" script by using this link which grabs the url of the page the visitor is on (the original script uses a refferer which is often blocked.) 

     

    <a href="http://www.mysite.com/friend.php?sharepage=http://www.mysite.com<?php echo $_SERVER['REQUEST_URI']; ?>">Share this page</a>

     

    In my friend script, I use GET to retrive the url to be shared then I assign it to $url2.  The user then enters their info and the info of the people to share the page with.  When they hit submit, the form posts to itself and $url2 is passed as a hidden variable "share_url" which I assign to $url3 for printing in the email.

     

    My problem is the shared address is cutoff at the first "&" if I have an address like: "http://www.mysite.com/hello.php?page_id=12&topic=news&date=apr09" All I would get is "http://www.mysite.com/hello.php?page_id=12"

     

    What am I doing wrong?

     

    This is my friend.php script:

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    
    <html>
    <head>
    <title>Share page</title>
    <link rel="stylesheet" href="recommend.css" type="text/css">
    </head>
    <body>
    <table width="100%" height="100%">
    <tr>
    	<td align="center" valign="middle">
    <?php
    
    //******************************************************************* 
    //  File:		inc.recommend.php © Big Lick Media - BigLickMedia.com
    //  Author:	D Stewart
    //  Update:	04-16-2006
    //  Version:	2.4.4
    //*******************************************************************
    
    /* Config Section */
    //$referrer = $_SERVER['HTTP_REFERER'];
    
    $sitename = 'My Site';			// Name of your site.
    
    $url = 'http://www.mysite.com';		// Web address for your site.
    
    $url2 = $_GET['sharepage'];	// Actual page to be sent
    $url3 = $_POST['share_url'];   // url was passed as hidden variable
    
    $webmasterEmail = 'me@mysite.com';		// Your email address.
    
    $receiveNotifications = 1;			// 0=no, 1=yes. If yes, you will be notified of the recipients and the message.
    
    $errorstyleclass = 'error';			// The class that specifies the CSS error color.
    
    $numberofrecipients = 10;			// Number of recipient email address fields to be displayed.
    
    $emailsubject = 'Great Website';		//Email subject line.
    
    $emailmessage = "Hello,\n\r[name] thought you would like to visit the following web page: $url3";		// Message in email body. 
    
    /* End Config */
    
    
    $mailsent = false; 
    $errormessages = array(); 
    $errorfields = array(); 
    
    if(count($_POST) > 0) { 
        if(get_magic_quotes_gpc()) $_POST = strip_magic_quotes($_POST); 
    
        if(empty($_POST['name'])) { 
            $errormessages[] = 'Please enter your name.'; 
            $errorfields[] = 'name'; 
        } 
       
        if(empty($_POST['email'])) { 
            $errormessages[] = 'Please enter your email address.'; 
            $errorfields[] = 'email'; 
        } else { 
            if(!eregi("^[a-z0-9\._-]+@+[a-z0-9\._-]+\.+[a-z]{2,3}$", $_POST['email'])) { 
                $errormessages[] = 'Please enter a proper email address for yourself.'; 
                $errorfields[] = 'email'; 
            } 
        } 
       
        for($i=1, $count=count($_POST['to']); $i<=$count; $i++) { 
            if(empty($_POST['to'][$i])) unset($_POST['to'][$i]); 
        } 
       
        if(empty($_POST['to'])) { 
            $errormessages[] = 'Please enter at least one friend\'s email address.'; 
            $errorfields[] = 'to[1]'; 
        } else { 
            foreach($_POST['to'] as $key=>$value) { 
                if(!empty($value)) { 
                    if(!eregi("^[a-z0-9\._-]+@+[a-z0-9\._-]+\.+[a-z]{2,3}$", $value)) { 
                        $errormessages[] = 'Please enter email address #' . $key . ' proper.'; 
                        $errorfields[] = "to[$key]"; 
                    } 
                } 
            } 
        } 
    
        // Now if there are no errors, send the message. 
        if(empty($errormessages)) { 
            $emailsubject = str_replace('[name]', $_POST['name'], $emailsubject); 
            $emailsubject = str_replace('[email]', $_POST['email'], $emailsubject); 
            $emailmessage = str_replace('[name]', $_POST['name'], $emailmessage);
            $emailmessage = str_replace('[url]', $url, $emailmessage); 
            //$emailmessage = str_replace('[share_url]', $_REQUEST['share_url'], $emailmessage); 
            $emailmessage .= "\r\n\n" . 
                              $_POST['message'] . 
                              "\n\n\n\nNote: This message was not sent unsolicited.  It was sent through a form located at the website: $url. ";
    
            $emailheader = "From: " . $_POST['email'] . "\r\n" . 
                           "Reply-To: " . $_POST['email'] . "\r\n" . 
                           "X-Mailer: Big Lick Media - php Site Recommender\r\n"; 
             
            $sent = array(); 
            foreach($_POST['to'] as $key=>$value) { 
                if(mail($value, $emailsubject, $emailmessage, $emailheader)) { 
                    $sent[] = $value; 
                } 
            } 
            $failed = array_diff($_POST['to'], $sent); 
            $mailsent = true; 
             
            if($receiveNotifications) { 
                $subject = 'Site recommended'; 
                $message = 'This is a message to tell you that ' . $_POST['name'] . ' (' . $_POST['email'] .') ' . @gethostbyaddr($_SERVER["REMOTE_ADDR"]) . ' sent a website recommendation to ' . implode(', ', $sent) . "\n\nMessage: " .  $_POST['message']; 
                $headers = 'From: ' .  $_POST['email'] . "\r\n" . 'X-Mailer: Big Lick Media - php Site Recommender'; 
                @mail($webmasterEmail, $subject, $message, $headers); 
            } 
        } 
    } 
    
    ?> 
    
    <?php 
    if($mailsent) { 
    echo empty($sent) ? '' : '<p>Message was successfully sent to ' . implode(', ', $sent) . '</p>'; 
    echo empty($failed) ? '' : '<p>Message was NOT successfully sent to ' . implode(', ', $failed) . '<br />Please try again later!</p>';
        echo '<p>Thank you very much for sharing ' , $sitename , '</p>'; 
    } else { 
        if(count($_POST) > 0 && !empty($errormessages)) { 
            echo '<table><tr><td><span class="' , $errorstyleclass , '">'; 
            echo 'The following error(s) occured:<br />'; 
            foreach($errormessages as $value) { 
                echo '     » ' ,$value , '<br />'; 
            } 
            echo '</span><br /></td></tr></table>'; 
        } 
    ?> 
    
    <table>
    <form method="post" action="<?php echo $_SERVER['PHP_SELF'];?>">
    <tr>
    	<td class="formtexttitle" colspan="2">  Recommend <?php echo $sitename; ?> to your friends and family</td>
    </tr>
        <tr>
            <td class="formtext">Your Name:</td>
            <td><input type="text" name="name" value="<?php echo isset($_POST['name']) ? $_POST['name'] : ''; ?>" class="<?php echo in_array('name', $errorfields) ? $errorstyleclass : ''; ?>" onfocus="this.style.borderColor='#0072BC';" onblur="this.style.borderColor='silver';" />
            </td>
        </tr>
        <tr>
            <td class="formtext">Your Email:</td>
            <td><input type="text" name="email" value="<?php echo isset($_POST['email']) ? $_POST['email'] : ''; ?>" class="<?php echo in_array('email', $errorfields) ? $errorstyleclass : ''; ?>" onfocus="this.style.borderColor='#0072BC';" onblur="this.style.borderColor='silver';" />
            </td>
        </tr>
        <tr>
            <td colspan="2"> Recipient Email Addresses  <span class="basefontblue">(Enter at least one)<br/>      (To enter more than 10, simply revisit this page)<br/></span><br/><br /></td>
        </tr>
    <tr>
            <td class="formtext">1.</td>
            <td><input type="text" name="to[1]" value="" class="" onfocus="this.style.borderColor='#0072BC';" onblur="this.style.borderColor='silver';" /></td>
        </tr>
        <?php 
        for($i=2; $i<=$numberofrecipients; $i++) { 
            $value = isset($_POST['to'][$i]) ? $_POST['to'][$i] : ''; 
            $class = in_array("to[$i]", $errorfields) ? $errorstyleclass : ''; 
            echo "    <tr>\n"; 
            echo '        <td class="formtext">' , $i , ".</td>\n"; 
            echo '        <td><input type="text" name="to[', $i ,']" value="', $value ,'" class="', $class ,"\" onfocus=\"this.style.borderColor='#0072BC';\" onblur=\"this.style.borderColor='silver';\" /></td>\n"; 
            echo "    </tr>\n"; 
        } 
        ?> 
        <tr>
            <td colspan="2">Your Message  (<span class="basefontblue">Optional</span>)<br />
    	<textarea name="message" rows="4" cols="40" class="<?php echo in_array('messsage', $errorfields) ? $errorstyleclass : ''; ?>" onfocus="this.style.borderColor='#0072BC';" onblur="this.style.borderColor='silver';"><?php echo isset($_POST['message']) ? $_POST['message'] : '';?></textarea>
            </td>
        </tr>
    <input type="hidden" name="share_url" value="<? echo $url2; ?>" />
        <tr>
            <td colspan="2">
                <table>
                    <tr>
                        <td><input class="send" type="submit" value="Send Now" /></td>
                        <td class="formtext"> </td>
                        <td><input class="reset" type="reset" value="Reset Form" /></td>
                    </tr>
                </table>
            </td>
        </tr>
    
    </form>
    </table>
    <?php 
    } 
    
    function strip_magic_quotes($arr) { 
        foreach($arr as $k => $v) { 
            if(is_array($v)) { 
                $arr[$k] = strip_magic_quotes($v); 
            } else { 
                $arr[$k] = stripslashes($v); 
            } 
        } 
        return $arr; 
    } 
    
    ?>
    	</td>
    </tr>
    </table>
    </body>
    </html>

  6. I got this fix from another board.  Thanks to "job0107."  Seems to work fine.  Do you have any other suggestions that might be helpful?

     

    Change #right_sidebar to this and it will fix part of the problem.

     

    #right_sidebar {
        float: left;
        width: 177px;
        font-size: small;
        color: #000000;
        margin: 0px;
        padding: 0px;
        border: 0px;
    }

     

     

    Then in the html in the <!-- start right_sidebar --> section, add a negative right margin to the corner image (images/img04a.png).

     

        <div align="right"><img style="margin-right:-3px;" src="images/img04a.png" alt="right sidebar" width="40" height="23" /></div>

     

     

    These corrections seem to make it work fine in IE 6 and FF 3.

     

    I also deleted this:

    <!--[if IE]>
    <style type="text/css"> 
    /* place css fixes for all versions of IE in this conditional comment */
    #column, #right_sidebar { zoom: 1; }
    /* the above proprietary zoom property gives IE the hasLayout it needs to avoid several bugs */
    </style>
    <![endif]-->

  7. I have a page that seems to display well in most browsers except in IE 6 (and possibly below).  The content that should appear in the right_sidebar is shifted to the bottom left of the page.  Dreamweaver has shown a "three-pixel text jog" error.  I have read several articles on the IE bugs especially the ones at positioneverything.com but I still can't solve my problem.

     

    Here is what I have:

    http://thebeaconpage.com/test/test.html - Get the source code

    http://thebeaconpage.com/test/default.css  - css file

     

    This seems to be the suggested fix, but I apparently am not applying it correctly:

    <!--[if IE]>
    <style type="text/css"> 
    /* place css fixes for all versions of IE in this conditional comment */
    #column, #right_sidebar { zoom: 1; }
    /* the above proprietary zoom property gives IE the hasLayout it needs to avoid several bugs */
    </style>
    <![endif]-->

     

    Can someone show me what I am doing wrong?  This line my be my problem:

    #column, #right_sidebar { zoom: 1; }

    Thanks!

  8. I see why not. The company I work for only uses google analytic but if they ran a campaign for advs I would go that route; Includes for the ads.

     

    I dont see a point for the id to each page as the google ads are either static or they rotate automatically. At least of what I've seen around.

     

    The page id is actually part of a larger scheme I have to list functions on the page that I am including.  Content is assigned to the appropriate page based on page id.

  9. I am thinking about using "php include" to do the "sidebar" content on my pages so that when I make a change, I could just do it one time and it would update all of my pages.

     

    In addition to this, I had in mind assigning a page id to each page and displaying the google ads specific to each corresponding page using if-then statments based on the page id, also by using "php include".

     

    Is this a good idea?

  10. At this time, I have a flat (delimited) text file being used for my database. I am wondering what changes can be made to my existing code listed below to achieve my objective.

     

    If someone searched for "Rick A Smith" this script finds every instance of each word, which is fine. The only problem is that everytime the character "A" is found in the entire database, it shows as a result even when it is part of another word. For example: James, Richard, Mark, etc.

     

    How could I restrict the findings of "a" for example to only be found when there is a space before and after it like the example above: "Rick A Smith"

     

    Code Snippet:

     

    $months = array ( 
        'January' => '1', 
        'February' => '2', 
        'March' => '3', 
        'April' => '4', 
        'May' => '5', 
        'June' => '6', 
        'July' => '7', 
        'August' => '8', 
        'September' => '9', 
        'October' => '10', 
        'November' => '11', 
        'December' => '12', 
        ); 
    
        $file = file('data.txt'); 
        $keys = preg_split('/[\s,]+/', preg_replace('/([^a-z0-9\s])/i', '', trim($search) ) ); 
    
        if (sizeof($keys) > 5) 
        { 
            die("Please enter less keywords."); 
        } 
        else if (empty($keys[0])) 
        { 
            die("Please enter a valid keyword."); 
        } 
    
        $pattern = '/('. implode('|', $keys) .')/i'; 
        $matches = array(); 
        $matchcount = 0; 
    
        foreach (array_values($file) AS $data) 
        { 
            list($month, $day, $year, $info) = explode('|', trim($data) ); 
    
            if (preg_match($pattern, $info)) 
            { 
                $matches["$year {$months[$month]} $day"][] = preg_replace($pattern, '<span style="color:red;">$1</span>', $info); 
                $matchcount++; 
            } 
        } 
    
    
    
        if (sizeof($matches) > 0) 
        { 
            if($_REQUEST['sort'] == 'year') 
            { 
                 ksort($matches); 
            } 
            $count = 0; 
    
            printf('<center><b><p>%d match%s found.</p></b></center>', $matchcount, $matchcount == 1 ? NULL : 'es'); 
            $months = array_flip($months);                              // flip array to convert months back to names 
            foreach ($matches AS $days => $event) 
            { 
                foreach ($event AS $result) 
                { 
                    list($year, $month, $day ) = explode(' ', $days ); 
                    $month  = $months[$month];                        // convert back to month name 
                    $count++; 
    
                    echo '<b><font face="Times New Roman">' . $count . ') ' . $month  . ' ' . $day . ', ' . $year . '--' .'</font></b>'; 
                    echo '<font face="Times New Roman" size="2px">' . $result .'</font>'; 
                    echo "<p>"; 
    
                    if ($count >= 200) 
                    { 
                        echo '<center><b>Results displayed limited to 200.</b></center>'; 
                        break; 
                    } 
    
                } 
    
                if ($count >= 200) 
                { 
                    break; 
                } 
            } 
            printf('<center><b><p>%d match%s found.</p></b></center>', $matchcount, $matchcount == 1 ? NULL : 'es'); 
        } 
        else 
        { 
            echo '<p><center><b>No results were found for your search--Please try again.</b></center></p>'; 
        }

  11. How could I set a scroll loop limit of 5 times for this scroll script so that it stops after 5 loops?

     

    <script language=JavaScript1.2>
    /* USE WORDWRAP AND MAXIMIZE THE WINDOW TO SEE THIS FILE
    ========================================
    NewsBar v1.4
    License : Freeware (Enjoy it!)
    (c)2004 VASIL DINKOV- PLOVDIV, BULGARIA
    ========================================
    For IE4+, NS4+, Opera7+ & Konqueror2+
    ========================================
    Get the NewsBar script at:
    http://www.smartmenus.org/other.php
    and don't wait to get the Great SmartMenus script at:
    http://www.smartmenus.org
    LEAVE THESE NOTES PLEASE - delete the comments if you want */
    
    // BUG in Opera:
    // If you want to be able to control the body margins
    // put the script right after the BODY tag, not in the HEAD!!!
    
    // === 1 === FONT, COLORS, EXTRAS...
    n_font='verdana,arial,sans-serif';
    n_fontSize='11px';//10px originally
    n_fontSizeNS4='12px';//11px originally
    n_fontWeight='normal';
    n_fontColor='#ffffff';
    n_textDecoration='none';
    n_fontColorHover='#ff0000';//		| won't work
    n_textDecorationHover='underline';//	| in Netscape4
    n_bgColor='#000000';//set [='transparent'] for transparent or use #000000
    n_top=5;//100 originally	  |
    n_left=20;//30 originally	  | defining
    n_width=468;//500 originally      | the box
    n_height=20;//14 originally       |
    n_position='absolute';// absolute or relative
    n_timeOut=5;//seconds
    n_pauseOnMouseOver=true;
    n_speed=50;//1000 = 1 second
    n_leadingSign='';//originally was '_'
    n_alternativeHTML='';//use www.smartmenus.org between qoutes or leave blank
    // for not supported browsers like Opera<7 - usually
    // you may want to put a link to your news page
    
    // === 2 === THE CONTENT - ['href','text','target']
    n_content=[
    ['','Welcome to the NewsBar example page!',''],
    ['http://www.smartmenus.org/','You can always get the latest version at: http://www.smartmenus.org/','_self'],
    ['http://www.smartmenus.org/','Or you may want to get the most advanced navigation system for your site?','_self']
    ];
    
    // THE SERIOUS SCRIPT 
    n_nS4=document.layers?1:0;
    n_iE=document.all && !window.innerWidth && navigator.userAgent.indexOf("MSIE")!=-1?1:0;
    n_nSkN=document.getElementById && (navigator.userAgent.indexOf("Opera")==-1 || document.body.innerHTML) && !n_iE?1:0;
    n_t=0;
    n_cur=0;
    n_l=n_content[0][1].length;
    n_timeOut*=1000;
    n_fontSize2=n_nS4 && navigator.platform.toLowerCase().indexOf("win")!=-1?n_fontSizeNS4:n_fontSize;
    document.write('<style>.nnewsbar,a.nnewsbar,a.nnewsbar:visited,a.nnewsbar:active{font-family:'+n_font+';font-size:'+n_fontSize2+';color:'+n_fontColor+';text-decoration:'+n_textDecoration+';font-weight:'+n_fontWeight+'}a.nnewsbar:hover{color:'+n_fontColorHover+';text-decoration:'+n_textDecorationHover+'}</style>');
    n_p=n_pauseOnMouseOver?" onmouseover=clearTimeout(n_TIM) onmouseout=n_TIM=setTimeout('n_new()',"+n_timeOut+")>":">";
    n_k=n_nS4?"":" style=text-decoration:none;color:"+n_fontColor;
    
    function n_new(){
        if(!(n_iE||n_nSkN||n_nS4))
            return;
        var O,mes;
        O=n_iE?document.all['nnewsb']:n_nS4?document.layers['n_container'].document.layers['nnewsb']:document.getElementById('nnewsb');
        mes=n_content[n_t][0]!="" && n_cur==n_l?("<a href='"+n_content[n_t][0]+"' target='"+n_content[n_t][2]+"' class=nnewsbar"+n_p+n_content[n_t][1].substring(0,n_cur)+n_leadingSign+"</a>")"<span class=nnewsbar"+n_k+">"+n_content[n_t][1].substring(0,n_cur)+n_leadingSign+"</span>");
        if(n_nS4)
            with(O.document){
                open();
                write(mes);
                close()
            }
        else
            O.innerHTML=mes;
        if(n_cur++==n_l){
            n_cur=0;
            n_TIM=setTimeout("n_new()",n_timeOut);
            n_t++;
            if(n_t==n_content.length)
                n_t=0;n_l=n_content[n_t][1].length
        }
        else{
            setTimeout("n_new()",n_speed)
        }
    
    }
    
    document.write('<div '+(n_nS4?"name":"id")+'=n_container style="position:'+n_position+';top:'+n_top+'px;left:'+n_left+'px;width:'+n_width+'px;height:'+n_height+'px;clip:rect(0,'+n_width+','+n_height+',0)"><div '+(n_nS4?"name":"id")+'=nnewsb style="position:absolute;top:0px;left:0px;width:'+n_width+';height:'+n_height+'px;clip:rect(0,'+n_width+','+n_height+',0);background-color:'+n_bgColor+';layer-background-color:'+n_bgColor+';text-decoration:none;color:'+n_fontColor+'" class=nnewsbar>'+n_alternativeHTML+'</div></div>');
    if(!n_nS4)
        setTimeout("n_new()",1000);
    else
        window.onload=n_new;
    if(n_nS4)
        onresize=function(){
            location.reload()
        }
    </script>

  12. My question is similiar to this post:

    Hi all,

     

    I need help with my php forms. I read an article that you can prevent form spam by using a hidden field, and requiring it to be blank for the form to be processed. I have no problems with setting the required html / css up, but have no idea where to start with the php code required to stop the form from being sent if left blank. I have very limited knowledge of php, please bare this in mind.

     

    Anyone point me in the right direction or explain the code to me please?

     

    I've tried a search on the forum but couldn't find anything, and sites that have mentioned the method never explain what you need to do with the php!

     

    Thanks in advance...!

     

    I placed this in the form:

    <input id="human" type="text" />

     

    I used this in the CSS to hide the field, this works:

    #human {
    visibility:hidden;
    display:none;
    }

     

    My question is, what is the correct php code?  I tried this and it didn't work:

    If (isset($_POST['human'])) {
         die;
    }

     

    I also tried this but it kills everything right of the bat without even displaying the form

    If (!isset($_POST['human'])) {
         die;
    }

×
×
  • 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.