0

im making reservation system online, i have a problem how to show the data choosen by the user to another php script? here's my code.

index.php code

<form method="post" action="confirmreserve.php" style="margin:auto;">
              <table width="95%" border="0" align="center" cellpadding="4" cellspacing="0">
                <tr>
                  <td width="50%" align="left" valign="top"><strong>Check-in Date</strong></td>
                  <td width="50%" align="left" valign="top" class="body2"><strong>Check-out Date</strong></td>
                </tr>
                <tr>
                  <td align="left" valign="top"><label>
                    <select name="month" id="month" style="width:60%;">
                      <option>January</option>
					  <option>February</option>
					  <option>March</option>
					  <option>April</option>
					  <option>May</option>
					  <option>June</option>
					  <option>July</option>
					  <option>August</option>
					  <option>September</option>
					  <option>October</option>
					  <option>November</option>
					  <option>December</option>
                    </select>
                    <select name="date" id="date" style="width:30%;">
					  <option>1</option>
					  <option>2</option>
                      <option>3</option>
                      <option>4</option>
                      <option>5</option>
					  <option>6</option>
					  <option>7</option>
					  <option>8</option>
					  <option>9</option>
					  <option>10</option>
					  <option>11</option>
					  <option>12</option>
					  <option>13</option>
					  <option>14</option>
					  <option>15</option>
					  <option>16</option>
					  <option>17</option>
					  <option>18</option>
					  <option>19</option>
					  <option>20</option>
					  <option>21</option>
					  <option>22</option>
					  <option>23</option>
					  <option>24</option>
					  <option>25</option>
					  <option>26</option>
					  <option>27</option>
					  <option>28</option>
					  <option>29</option>
					  <option>30</option>
                      <option>31</option>
					</select>
                  </label></td>
                  <td align="left" valign="top"><label>
                    <select name="month2" id="month2" style="width:60%;">
                       <option>January</option>
					  <option>February</option>
					  <option>March</option>
					  <option>April</option>
					  <option>May</option>
					  <option>June</option>
					  <option>July</option>
					  <option>August</option>
					  <option>September</option>
					  <option>October</option>
					  <option>November</option>
					  <option>December</option>
                    </select>
                    <select name="date2" id="date2" style="width:30%;">
                      <option>1</option>
                      <option>2</option>
                      <option>3</option>
                      <option>4</option>
                      <option>5</option>
                      <option>6</option>
                      <option>7</option>
                      <option>8</option>
                      <option>9</option>
                      <option>10</option>
                      <option>11</option>
                      <option>12</option>
                      <option>13</option>
                      <option>14</option>
                      <option>15</option>
                      <option>16</option>
                      <option>17</option>
                      <option>18</option>
                      <option>19</option>
                      <option>20</option>
                      <option>21</option>
                      <option>22</option>
                      <option>23</option>
                      <option>24</option>
                      <option>25</option>
                      <option>26</option>
                      <option>27</option>
                      <option>28</option>
                      <option>29</option>
                      <option>30</option>
                      <option>31</option>
                    </select>
                  </label></td>
                </tr>
                <tr>
                  <td colspan="2" align="left" valign="top" style="padding-bottom:10px; padding-top:10px;">
				  <table width="99%" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td width="36%" valign="top" class="body2"><strong>Room Type </strong></td>
                      <td width="36%" valign="top" class="body2"><strong>Occupancy</strong></td>
                      <td width="28%" valign="top" class="body2"><strong>No.of rooms</strong></td>
                    </tr>
                    <tr>
                      <td><label>
                        <select name="room" id="room">
                          <option>Standard</option>
						  <option>Superior</option>
						  <option>Deluxe</option>
						  <option>Suite</option>
                        </select>
                      </label></td>
                      <td><label>
                        <select name="occupancy" id="occupancy">
                          <option>Single</option>
						  <option>Double</option>
                        </select>
                      </label></td>
                      <td><label>
                        <select name="norooms" id="norooms">
						<option>1</option>
                          <option>2</option>
						  <option>3</option>
						  <option>4</option>
                        </select>
                      </label></td>
                    </tr>
                  </table></td>
                  </tr>
                <tr>
                  <td align="left" valign="top"><label>
                  <center><input type="submit" name="Submit" value="Proceed" /></center>
                  </label></td>
                  <td align="left" valign="top"><label>
                  <center><input type="reset" name="Submit2" value="Reset" /></center>
                  </label></td>
                </tr>
              </table>
                        </form>

i want to show the data user choosen above here

confirmreserve.php

<form method="post" action="">
		          <label>
		          <input type="text" name="textfield" value="<?php echo '$month'; ?>" width="60" />
		          </label>
		          <label>
		          <input type="text" name="textfield2" width="60" value="$_POST[date]"/>
		          </label>
		          <label>
		          <input type="text" name="textfield3" width="60" />
		          </label>
		        </form>		        </td>
		      </tr>
              <tr>
                <td><div align="right"><span class="style5">Check Out:</span></div></td>
                <td>&nbsp;</td>
                <td>
                  <label>
                    <input type="text" name="textfield4" width="60" />
                    </label>
                  <label>
                  <input type="text" name="textfield5" width="60" />
                  </label>
                  <label>
                  <input type="text" name="textfield6" width="60" />
                  </label>
                                </td>
              </tr></table></form>

please help

2
Contributors
9
Replies
10
Views
7 Years
Discussion Span
Last Post by ryan311
0

Well why not look into the $_GET and $_POST superglobals of PHP. They will allow you to display and work with form data submitted by a user. Try: W3Schools PHP Forms

If you could elaborate on what you want each of the textfields on confirmreserve.php to contain, I can give you an example.

0

sir heres my code

here is my index.php

1.
      <form method="post" action="confirmreserve.php" style="margin:auto;">
   2.
      <table width="95%" border="0" align="center" cellpadding="4" cellspacing="0">
   3.
      <tr>
   4.
      <td width="50%" align="left" valign="top"><strong>Check-in Date</strong></td>
   5.
      <td width="50%" align="left" valign="top" class="body2"><strong>Check-out Date</strong></td>
   6.
      </tr>
   7.
      <tr>
   8.
      <td align="left" valign="top"><label>
   9.
      <select name="month" id="month" style="width:60%;">
  10.
      <option>January</option>
  11.
      <option>February</option>
  12.
      <option>March</option>
  13.
      <option>April</option>
  14.
      <option>May</option>
  15.
      <option>June</option>
  16.
      <option>July</option>
  17.
      <option>August</option>
  18.
      <option>September</option>
  19.
      <option>October</option>
  20.
      <option>November</option>
  21.
      <option>December</option>
  22.
      </select>
  23.
      <select name="date" id="date" style="width:30%;">
  24.
      <option>1</option>
  25.
      <option>2</option>
  26.
      <option>3</option>
  27.
      <option>4</option>
  28.
      <option>5</option>
  29.
      <option>6</option>
  30.
      <option>7</option>
  31.
      <option>8</option>
  32.
      <option>9</option>
  33.
      <option>10</option>
  34.
      <option>11</option>
  35.
      <option>12</option>
  36.
      <option>13</option>
  37.
      <option>14</option>
  38.
      <option>15</option>
  39.
      <option>16</option>
  40.
      <option>17</option>
  41.
      <option>18</option>
  42.
      <option>19</option>
  43.
      <option>20</option>
  44.
      <option>21</option>
  45.
      <option>22</option>
  46.
      <option>23</option>
  47.
      <option>24</option>
  48.
      <option>25</option>
  49.
      <option>26</option>
  50.
      <option>27</option>
  51.
      <option>28</option>
  52.
      <option>29</option>
  53.
      <option>30</option>
  54.
      <option>31</option>
  55.
      </select>
  56.
      </label></td>
  57.
      <td align="left" valign="top"><label>
  58.
      <select name="month2" id="month2" style="width:60%;">
  59.
      <option>January</option>
  60.
      <option>February</option>
  61.
      <option>March</option>
  62.
      <option>April</option>
  63.
      <option>May</option>
  64.
      <option>June</option>
  65.
      <option>July</option>
  66.
      <option>August</option>
  67.
      <option>September</option>
  68.
      <option>October</option>
  69.
      <option>November</option>
  70.
      <option>December</option>
  71.
      </select>
  72.
      <select name="date2" id="date2" style="width:30%;">
  73.
      <option>1</option>
  74.
      <option>2</option>
  75.
      <option>3</option>
  76.
      <option>4</option>
  77.
      <option>5</option>
  78.
      <option>6</option>
  79.
      <option>7</option>
  80.
      <option>8</option>
  81.
      <option>9</option>
  82.
      <option>10</option>
  83.
      <option>11</option>
  84.
      <option>12</option>
  85.
      <option>13</option>
  86.
      <option>14</option>
  87.
      <option>15</option>
  88.
      <option>16</option>
  89.
      <option>17</option>
  90.
      <option>18</option>
  91.
      <option>19</option>
  92.
      <option>20</option>
  93.
      <option>21</option>
  94.
      <option>22</option>
  95.
      <option>23</option>
  96.
      <option>24</option>
  97.
      <option>25</option>
  98.
      <option>26</option>
  99.
      <option>27</option>
 100.
      <option>28</option>
 101.
      <option>29</option>
 102.
      <option>30</option>
 103.
      <option>31</option>
 104.
      </select>
 105.
      </label></td>
 106.
      </tr>
 107.
      <tr>
 108.
      <td colspan="2" align="left" valign="top" style="padding-bottom:10px; padding-top:10px;">
 109.
      <table width="99%" border="0" cellspacing="0" cellpadding="0">
 110.
      <tr>
 111.
      <td width="36%" valign="top" class="body2"><strong>Room Type </strong></td>
 112.
      <td width="36%" valign="top" class="body2"><strong>Occupancy</strong></td>
 113.
      <td width="28%" valign="top" class="body2"><strong>No.of rooms</strong></td>
 114.
      </tr>
 115.
      <tr>
 116.
      <td><label>
 117.
      <select name="room" id="room">
 118.
      <option>Standard</option>
 119.
      <option>Superior</option>
 120.
      <option>Deluxe</option>
 121.
      <option>Suite</option>
 122.
      </select>
 123.
      </label></td>
 124.
      <td><label>
 125.
      <select name="occupancy" id="occupancy">
 126.
      <option>Single</option>
 127.
      <option>Double</option>
 128.
      </select>
 129.
      </label></td>
 130.
      <td><label>
 131.
      <select name="norooms" id="norooms">
 132.
      <option>1</option>
 133.
      <option>2</option>
 134.
      <option>3</option>
 135.
      <option>4</option>
 136.
      </select>
 137.
      </label></td>
 138.
      </tr>
 139.
      </table></td>
 140.
      </tr>
 141.
      <tr>
 142.
      <td align="left" valign="top"><label>
 143.
      <center><input type="submit" name="Submit" value="Proceed" /></center>
 144.
      </label></td>
 145.
      <td align="left" valign="top"><label>
 146.
      <center><input type="reset" name="Submit2" value="Reset" /></center>
 147.
      </label></td>
 148.
      </tr>
 149.
      </table>
 150.
      </form>

if user click proceed the date he choose should go to my textfield here in confirmreserve.php

1.
      <form method="post" action="">
   2.
      <label>
   3.
      <input type="text" name="textfield" value="<?php echo '$month'; ?>" width="60" />
   4.
      </label>
   5.
      <label>
   6.
      <input type="text" name="textfield2" width="60" value="$_POST[date]"/>
   7.
      </label>
   8.
      <label>
   9.
      <input type="text" name="textfield3" width="60" />
  10.
      </label>
  11.
      </form> </td>
  12.
      </tr>
  13.
      <tr>
  14.
      <td><div align="right"><span class="style5">Check Out:</span></div></td>
  15.
      <td>&nbsp;</td>
  16.
      <td>
  17.
      <label>
  18.
      <input type="text" name="textfield4" width="60" />
  19.
      </label>
  20.
      <label>
  21.
      <input type="text" name="textfield5" width="60" />
  22.
      </label>
  23.
      <label>
  24.
      <input type="text" name="textfield6" width="60" />
  25.
      </label>
  26.
      </td>
  27.
      </tr></table></form>
0

Oh, my bad! Sorry about asking for the code again...don't know what I was looking at! What you need is a simple fix. I'm working on it right now and will post it soon! While working, I did notice you forgot a field for State/Province. Is this intended?

0

sir its only for me if just this one

<select name="month" id="month" style="width:60%;">
                      <option>January</option>
					  <option>February</option>
					  <option>March</option>
					  <option>April</option>
					  <option>May</option>
					  <option>June</option>
					  <option>July</option>
					  <option>August</option>
					  <option>September</option>
					  <option>October</option>
					  <option>November</option>
					  <option>December</option>
                    </select>

if the user choose november i want it in my confirmreserve.php in my textfield should put november.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.