Re: Placing a form on a page

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 05/06/2013 09:35 AM, OJFR wrote:
Ethan, to center your form you just need to chance a little bit its
structure as follows:

<div class="to_center"></div>

<div id="frm">
	<form   name="poster"  method="post"  action="">
		<input type="text" name="cnum" hidden="hidden"></input>
		<input type='hidden' name='welcome_already_seen'
value='already_seen'>
		<?php echo "<center><input type='submit' value='Validate
Choice' /></center>"; echo"
                </form>"; ?>
</div>

<div class="to_center"></div>

And go to your CSS file and add this lines:

.to_center  {
	width: auto;
}

That will solve your problem because when you have a fixed div between two
columns with an auto width declared, those two columns take the exact width
to fill completely the width of their container (adding also the fixed width
of the div of your form). If you have any trouble understanding this just
ask 'cause English is not my first language, so I'll try to explain myself
better. I also recommend that if you are having problems with CSS and HTML
structure, you should consider to use Twitter Bootstrap. Google it and I
guess it will be pretty useful for you in the future.

Greetings,

Osain.

-----Mensaje original-----
De: Ethan Rosenberg, PhD [mailto:erosenberg@xxxxxxxxxxxxxxxxxxxx]
Enviado el: lunes, 06 de mayo de 2013 12:23 AM
Para: PHP Database List
Asunto: [?? Probable Spam]  Placing a form on a page

Dear List -
I apologize if I offended some of you. I will see that it does not repeat.
I am trying to center a form on the top of a page. Here is the form:

<div id="frm">
<form   name="poster"  method="post"  action="">
<input type="text" name="cnum" hidden="hidden"></input>  <input
type='hidden' name='welcome_already_seen' value='already_seen'>  <?php echo
"<center><input type='submit' value='Validate Choice' /></center>"; echo
"</form>"; ?>  </div>


It is aligned on the p;age with the following css - #frm{
position: fixed;
top: 5%;
left:42%;
}

It aligns perfectly with this form

function show_welcome()
{
$custnum     = isset($_REQUEST["Cust_Num"]) ? $_REQUEST["Cust_Num"] : "";
$first_name = isset($_REQUEST["Fname"])  ? $_REQUEST["Fname"] : "";
$last_name  = isset($_REQUEST["Lname"])  ? $_REQUEST["Lname"] : "";
$street     = isset($_REQUEST["Street"]) ? $_REQUEST["Street"] : "";
$city   = isset($_REQUEST['City']) ?   $_REQUEST['City'] : "";
$state   = isset($_REQUEST['State']) ?   $_REQUEST['State'] : "";
$zip   = isset($_REQUEST['Zip']) ?   $_REQUEST['Zip'] : "";
$phone      = isset($_REQUEST["Phone"])  ? $_REQUEST["Phone"] : "";
$date   = isset($_REQUEST['Date']) ?   $_REQUEST['Date'] : "";
$notes   = isset($_REQUEST['Notes']) ?   $_REQUEST['Notes'] : "";
$p1      = isset($_REQUEST['PH1']) ?   $_REQUEST['PH1'] : "";
$p2      = isset($_REQUEST['PH2']) ?   $_REQUEST['PH2'] : "";
$p3      = isset($_REQUEST['PH3']) ?   $_REQUEST['PH3'] : "";


echo "<br /><br />";
echo "<center>";
echo "<form  method=\"post\">";
echo "<strong>Customer Number:</strong>  <input type='text'
name='Cust_Num'  value='$custnum' /></input><br /><br />"; echo"
<strong>First Name:</strong>  <input type=\"text\" name=\"Fname\"
value='$first_name' />";
echo "<strong>Last Name:</strong>  <input type=\"text\" name=\"Lname\"
value='$last_name' /></input><br /><br />"; echo "<strong>Street:
</strong><input type= 'text'  name= 'Street'
value='$street' /></input>";
echo "<strong>City:</strong><input type= 'text'  name= 'City'
value='$city' /></input>";
echo "<strong>State:</strong>  <input type= 'text' size='2'
maxlength='2' name= 'state' value='NY' /></input>&nbsp"; echo "<strong>Zip
Code:</strong>  <input type= 'text' size='5'
maxlength='5' name= 'Zip' value='10952' /></input><br /><br />"; echo
"</center>"; echo"<center>"; echo"<div  id='phn'>  "; echo"
<strong>Phone:</strong>  (<input type='text' size='3'
maxlength='3' name='PH1' value='$p1'>)</input>"; echo"<input type='text'
size='3' maxlength='3' name='PH2' value = '$p2'></input>"; echo"<input
type='text' size='4' maxlength='4' name='PH3' value = '$p3'></input><br
/><br />"; echo"<strong>Date:</strong><input type='text' size='10'
maxlength='10'
   name='Date' value='$date'></input><br /><br />"; echo "</center>"; //
echo "</div>"; echo "<center>"; echo "<input type='submit'  /><br /><br
/>"; echo "&nbsp&nbsp&nbsp<input type='reset' value = 'Clear Form'  />";
echo "<input type='hidden' name='welcome_already_seen'
value='already_seen'>";
echo "<input type='hidden' name='next_step' value='step2' />"; echo"
</center>"; // goto step2; ?>  </form>


With this it is offset to the right.
echo "<center><strong>Do you wish to enter a Payment?</strong></center>";
echo "<form name='form2'  method='post'>"; echo"<center><strong>Name:
$_SESSION[Lname] echo $_SESSION[Fname]</strong></center>"; echo
"<center><input type='submit' name='button' value='YES'></center>"; echo
"<input type='hidden' name='welcome_already_seen'
value='already_seen'>";
echo "<input type='hidden' name='next_step' value='step5' />"; echo
"</form>"; echo"<center><strong>Do you wish to enter a
Charge?</strong></center>"; echo"<form name='form1' method='post'>"; echo
"<center><strong>Name: $_SESSION[Lname],
$_SESSION[Fname]</strong></center>";
echo "<center><input type='submit' name='button' value='YES'
onclick='ClearScren'></center>";
echo "<input type='hidden' name='welcome_already_seen'
value='already_seen'>";
echo "<input type='hidden' name='next_step' value='step6' />"; echo
"</form>"; echo"<center><strong>Name: $_SESSION[Lname],
$_SESSION[Fname]</strong></center>";
echo "<center><strong>Are you Finished for Now?</strong></center>"; echo
"<form name='form1' action='exiter3.php' method='post'>"; // echo
"<center><input type='submit' name='button' value='YES'></center>"; echo
"</form>"; I know that I am doing something wrong, but cannot figure out
what it is.


Ethan


PS I know that the formatting of the above is an absolute disaster.
Icedove defaults to 80 columns, and pure test does not allow me to change
font size.  If you could show me how, it would be appreciated.

Thanks

--

===========

Thanks -

Works beautifully!!

Ethan

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php





[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux