הרשם שאלות ותשובות רשימת חברים לוח שנה הודעות מהיום

חזור   הוסטס - פורום אחסון האתרים הגדול בישראל > עיצוב גראפי, תכנות על כל שפותיו וקידום ושיווק אתרים > פורום תיכנות

   
|!|

 
 
כלים לאשכול תצורת הצגה
Prev הודעה קודמת   הודעה הבאה Next
ישן 01-08-07, 15:47   # 4
Daniel
אחראי פורום
 
מיני פרופיל
תאריך הצטרפות: Mar 2007
הודעות: 2,875

Daniel לא מחובר  

תוקן.
ותקינות וכל הדברים האלה זה דבר מאוד חשוב.
PHP קוד:
<?php
$to_print 
null;
$errors = array();
if (isset(
$_REQUEST["seen_already"])) {
    
validate_data();
    if (
count($errors) != 0) {
        
display_errors();
        
display_welcome();
    } else {
        
process_data();
    }
} else {
    
display_welcome();
}

function 
validate_data()
{
    global 
$errors$to_print;
    if (
$_REQUEST["Name"] == "") {
        
$errors[] = "<span style='color:red;'>Please enter your name</span>";
    }

    if (
strcmp($_REQUEST["Number"], strval(intval($_REQUEST["Number"])))) {
        
$errors[] = "<span style='color:red;'>Please enter an integer</span>";
    }
}

function 
display_errors()
{
    global 
$errors$to_print;

    foreach (
$errors as $err) {
        
$to_print.= $err"<br />";
    }

    foreach (
$errors as $err) {
        
$to_print.= $err"<br />";
    }
}
    function 
process_data()
    {
        global 
$to_print;
        
$to_print.= "Your name is ";

        
$ok_text htmlentities ($_REQUEST["Name"]);
        
$to_print.= $ok_text;

        
$to_print.= "Your integer is ";
        
$to_print.= $_REQUEST["Number"];
    }

    function 
display_welcome()
    {
        global 
$to_print;
        
$to_print.= <<<EOF
        <form method='POST' action='index.php'>
        What's your name?
        <br />
        <input type="text" name='Name'>
        <br />
        <br />
        <input type="submit" VALUE="Submit">
        <input type="hidden" name='seen_already' value='hidden_data'>
        </form>

        <form method='POST' action='index.php'>
        Please enter an integer.
        <br />
        <input type="text" name='Number'>
        <br />
        <br />
        <input type="hidden" name='seen_already' value='hidden_data'>
        <input type="submit" VALUE="Submit">
        </FORM>
EOF;
    }
echo 
$to_print;
    
?>
  Reply With Quote
 

חברים פעילים הצופים באשכול זה: 1 (0 חברים ו- 1 אורחים)
 


חוקי פירסום
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is מופעל
סמיילים הם מופעל
[IMG] קוד מופעל
קוד HTML מכובה

קפיצה לפורום


כל הזמנים הם GMT +2. הזמן כעת הוא 05:29.

מופעל באמצעות VBulletin גרסה 3.8.6
כל הזכויות שמורות ©
כל הזכויות שמורות לסולל יבוא ורשתות (1997) בע"מ