למה זה לא עובד:

Mr Boggy Man

New member
למה זה לא עובד:

שימו לב:
$x = 1; $test = $_POST['$x']; echo "$test<BR>";​
למה זה לא עובד?
 

אמיר ט

New member
משהו לא מובן

אתה מנסה לקבל את ערכו של משתנה ששלחת לסקריפט שקוראים לו 1, או שאתה רוצה את המשתנה הראשון שנשלח לסקריפט. בכל מקרה, תבדוק שאכן הטופס שולח ב POST ולא ב GET...
 

Mr Boggy Man

New member
יש לי ככה:

Form: <input type=text name=1> <input type=text name=2> <input type=text name=3> Check what the user type: $x = 1; $y = 3; while ($x <= $y) { if ($_POST['$x']) { echo "Input $x = ".$_POST['$x']."<BR>"; } $x++; }​
אבל מישומה הוא לא מצליח לעשות _POST[$x]
 

orenphp

New member
תחליף גרש בגרשיים:

סתם משהו זריז שכתבתי:
<? if (!(isset($_POST["1"]))) { ?> Form: <form action="test.php" method="POST"> 1. <input type=text name=1><br> 2. <input type=text name=2><br> 3. <input type=text name=3><br><br> <input type="submit" value="send"> </FORM> <? } else { $x = 1; $y = 3; while ($x <= $y) { if ($_POST["$x"]) { echo "Input $x = ".$_POST["$x"]."<BR>"; } $x++; } } ?>​
 
למעלה