Welcome to Dream.In.Code
Getting PHP Help is Easy!

Join 132,462 PHP Programmers for FREE! Get instant access to thousands of PHP experts, tutorials, code snippets, and more! There are 1,378 people online right now. Registration is fast and FREE... Join Now!




Php Posting...

2 Pages V  1 2 >  
Reply to this topicStart new topic

Php Posting..., NON-Database

liquidwayweb
post 22 Mar, 2005 - 07:48 PM
Post #1


New D.I.C Head

*
Joined: 23 Feb, 2005
Posts: 10

Okay...this is a TWO-Part Question:
FIRST:
Is it possible to have a drop-down menu within a form that when the form is submitted (and goes to verification) it shows the image that the drop-down menu is linked to within a table cell's background.
SECOND:
I'm still new with PHP, so I need help with IF...THEN statements. I need an IF Pay1 THEN Pay1 ELSE Pay2.

If there is anyone that can help, I'd greatly appreciate it.
Thanks,
User is offlineProfile CardPM

Go to the top of the page

Amadeus
post 22 Mar, 2005 - 08:02 PM
Post #2


g++ -o drink whiskey.cpp

Group Icon
Joined: 12 Jul, 2002
Posts: 12,173



Thanked 33 times

Dream Kudos: 25
My Contributions


Answer 1: Yes, it is.

Answer 2:
CODE

if(condition)
{
  //true condition code
}
else
{
  //false condition code
}

Any more than that on the code and you'll have to be more specific about what you need done.
User is offlineProfile CardPM

Go to the top of the page

liquidwayweb
post 22 Mar, 2005 - 10:39 PM
Post #3


New D.I.C Head

*
Joined: 23 Feb, 2005
Posts: 10

I thought that that might be it...wasn't sure though. Thanks...any idea on the first part?
User is offlineProfile CardPM

Go to the top of the page

cyberscribe
post 23 Mar, 2005 - 10:24 AM
Post #4


humble.genius

Group Icon
Joined: 5 May, 2002
Posts: 1,062



Thanked 2 times

Dream Kudos: 154
My Contributions


If the drop down menu contains a list of images, e.g.:

CODE

<form action="post">
<select name="foo">
<option value="bar.jpg">
...
</select>
<input type="submit" value="submit" name="baz">
</form>


Then you can reference the variable that is submitted this way:

CODE

<table><tr><td background="<?= $_POST['foo']; ?>">
...


and get:

CODE

<table><tr><td background="bar.jpg">
...


Make sense?
User is offlineProfile CardPM

Go to the top of the page

liquidwayweb
post 24 Mar, 2005 - 12:28 AM
Post #5


New D.I.C Head

*
Joined: 23 Feb, 2005
Posts: 10

Okay...so here's the code thus far. However I keep getting errors on lines 34, 43, and 65...I'm a newbie, so I don't know where they are in the line. Please let me know.
CODE
<html>
<head>
<title>Verify your Order</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body bgcolor="#FFFFCC" text="#000000" link="#000000" vlink="#000000" alink="#000000">
<p align="center"><font size="6" face="Brush Script MT">Please verify your order before
 submitting it.</font></p>
<form name="form2" method="post" action="">
 <table width="75%" height="285" border="0" align="center" cellpadding="0" cellspacing="0">
   <tr>
     <td colspan="5"><div align="center"><font color="#000000" size="5" face="Brush Script MT">Shipping
         Information</font></div></td>
   </tr>
   <tr>
     <td colspan="2"><div align="right"><font color="#000000" size="3" face="Brush Script MT">Recipient's
         Name:</font></div></td>
     <td colspan="3"><font color="#000000" size="3" face="Brush Script MT"><? echo $_POST['name-ship'] ?></font></td>
   </tr>
   <tr>
     <td colspan="2"><div align="right"><font color="#000000" size="3" face="Brush Script MT">Recipient's
         Address 1:</font></div></td>
     <td colspan="3"><font color="#000000" size="3" face="Brush Script MT"><? echo $_POST['address1'] ?></font></td>
   </tr>
   <tr>
     <td colspan="2"><p align="right"><font color="#000000" size="3" face="Brush Script MT">Recipient's
         Address 2:</font></p></td>
     <td colspan="3"><font color="#000000" size="3" face="Brush Script MT"><?php echo $_POST['address2'] ?></font></td>
   </tr>
   <tr>
     <td colspan="2"><div align="right"><font color="#000000" size="3" face="Brush Script MT">City,
         State Zip</font></div></td>
     <td colspan="3"><font color="#000000" size="3" face="Brush Script MT"><?php echo $_POST['city']", "$_POST['state']" "$_POST['zipcode'] ?></font></td>
   </tr>
   <tr>
     <td colspan="5"><div align="center"><font color="#000000" size="5" face="Brush Script MT">Gift
         Information </font></div></td>
   </tr>
   <tr>
     <td width="5%" bgcolor="<? $_POST['frame-type'] ?>"></td>
     <td width="5%" bgcolor="<? $_POST['matte'] ?>"></td>
     <td width="90%" background="<? $_POST['background'] ?>"><? echo $_POST['name'] ?><br>
       <? echo $_POST['type'] ?><br> <? echo $_POST['month']" " $_POST['day']", "$_POST['year'] ?></td>
   </tr>
   <tr>
     <td colspan="3"> <div align="center"> <font face="Brush Script MT">
         <input type="submit" name="Submit" value="Submit my Order">
         To Edit Incorrect Information, hit your BACK button your browser</font></div></td>
   </tr>
 </table>
 <div align="center">
   <p><br>
     <font size="5" face="Brush Script MT">Paying for your order:</font></p>
   <table width="75%" border="0" cellspacing="0" cellpadding="0">
     <tr>
       <td><div align="right"><font size="4" face="Brush Script MT">Method of
           Payment:</font></div></td>
       <td><select name="method" size="1" id="method">
           <option selected>Select One...</option>
           <option value="Check/Money Order">Check/Money Order</option>
           <option value="Credit Card via PayPal">Credit Card via PayPal</option>
         </select></td>
     </tr>
     <tr>
       <td colspan="2"><div align="left"><font face="Brush Script MT">
           <? if $_POST['method']="Check/Money Order" { echo "Please print out this page and mail it with your payment to:<br>Designs By Diane<br>212 Tantillon Drive<br>Ocean Springs, MS 39564";?>
           </font></div></td>
     </tr>
     <tr>
       <td><div align="right"><font face="Brush Script MT"><font face="Brush Script MT"><font size="4">
           <?php
if $_POST['frame'] = "No" {
echo "<form action=https://www.paypal.com/cgi-bin/webscr method=post><input type=hidden name=cmd value=_s-xclick>
<input type=image src=https://www.paypal.com/en_US/i/btn/x-click-but23.gif border=0 name=submit alt=Make payments with PayPal - it's fast, free and secure!>
<input type=hidden name=encrypted value=-----BEGIN PKCS7-----PKCS7-----</form>";
}
else $_POST['frame'] = "Yes" {
echo "<form action=https://www.paypal.com/cgi-bin/webscr method=post>
<input type=hidden name=cmd value=_s-xclick>
<input type=image src=https://www.paypal.com/en_US/i/btn/x-click-butcc.gif border=0 name=submit alt=Make payments with PayPal - it's fast, free and secure!>
<input type=hidden name=encrypted value=-----BEGIN PKCS7-----PKCS7-----</form>";
?>
           </font></font><font size="4"> </font></font></div></td>
       <td>&nbsp;</td>
     </tr>
   </table>
   <p>&nbsp; </p>
 </div>
</form>
<div align="center"><br>
</div>
<div align="center"></div>
</body>
</html>

YEA!!! I got it in the box!!!

This post has been edited by liquidwayweb: 24 Mar, 2005 - 09:02 AM
User is offlineProfile CardPM

Go to the top of the page

DanceInstructor
post 24 Mar, 2005 - 08:23 AM
Post #6


New D.I.C Head

Group Icon
Joined: 18 Mar, 2005
Posts: 41



Dream Kudos: 25
My Contributions


Instead of:

CODE
<?php echo $_POST['city']", "$_POST['state']" "$_POST['zipcode'] ?>


try:

CODE
<?php echo ("$_POST['city'], $_POST['state'] $_POST['zipcode']"); ?>


Double quotes " allow for variables to be used within strings. Single quotes ' do not.

Maybe you could edit your post and take out the loooonnnnggggg encrypted values so the forum won't get stretched so badly......
User is offlineProfile CardPM

Go to the top of the page

liquidwayweb
post 24 Mar, 2005 - 08:56 AM
Post #7


New D.I.C Head

*
Joined: 23 Feb, 2005
Posts: 10

Sorry about that...didn't realize I could go back and edit... Okay...so that should take care of line 34's errors. But what about lines 43 and 65?
User is offlineProfile CardPM

Go to the top of the page

liquidwayweb
post 24 Mar, 2005 - 09:00 AM
Post #8


New D.I.C Head

*
Joined: 23 Feb, 2005
Posts: 10

Okay...here is the error that I am getting...still referring to the same line of the city/state/zip line.

Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING on line 34

Please let me know...
User is offlineProfile CardPM

Go to the top of the page

DanceInstructor
post 24 Mar, 2005 - 04:22 PM
Post #9


New D.I.C Head

Group Icon
Joined: 18 Mar, 2005
Posts: 41



Dream Kudos: 25
My Contributions


hmmm.... how bout you post the lines you are talking about? or even better post the 2 or 3 lines before and after the lines you mentioned. Call me lazy but I don't want to count all those lines to figure out what the problem is. blink.gif
User is offlineProfile CardPM

Go to the top of the page

liquidwayweb
post 24 Mar, 2005 - 06:08 PM
Post #10


New D.I.C Head

*
Joined: 23 Feb, 2005
Posts: 10

I'm lazy too...that's kinda why I didn't do it in the first place... tongue.gif

Here are lines 31-35 (basically that particular TR)
CODE

 <tr>
     <td colspan="2"><div align="right"><font color="#000000" size="3" face="Brush Script MT">City,
         State Zip</font></div></td>
     <td colspan="3"><font color="#000000" size="3" face="Brush Script MT"><?php echo ("$_POST['city'], $_POST['state'] $_POST['zipcode']");  ?></font></td>
   </tr>

Lines 40-45 (again, the table row)
CODE
<tr>
     <td width="5%" bgcolor="<? $_POST['frame-type'] ?>"></td>
     <td width="5%" bgcolor="<? $_POST['matte'] ?>"></td>
     <td width="90%" background="<? $_POST['background'] ?>"><? echo $_POST['name'] ?><br>
       <? echo $_POST['type'] ?><br> <? echo $_POST['month']" " $_POST['day']", "$_POST['year'] ?></td>
   </tr>


And the final line in question, lines 65-69 (another row...I like tables):
CODE
<tr>
       <td colspan="2"><div align="left"><font face="Brush Script MT">
           <? if $_POST['method']="Check/Money Order" { echo "Please print out this page and mail it with your payment to:<br>Designs By Diane<br>212 Tantillon Drive<br>Ocean Springs, MS 39564";?>
           </font></div></td>
     </tr>


If you can solve this...thanks a BUNCH!!!
User is offlineProfile CardPM

Go to the top of the page

DanceInstructor
post 24 Mar, 2005 - 06:48 PM
Post #11


New D.I.C Head

Group Icon
Joined: 18 Mar, 2005
Posts: 41



Dream Kudos: 25
My Contributions


Can you post the form that creates the $_POST variables?
User is offlineProfile CardPM

Go to the top of the page

RichardSA
post 28 Mar, 2005 - 09:59 AM
Post #12


New D.I.C Head

Group Icon
Joined: 16 Feb, 2005
Posts: 24



Dream Kudos: 25
My Contributions


Lines 40-45 error:

change :
CODE
<td width="90%" background="<? $_POST['background'] ?>">

to:
CODE
<td width="90%" background="<? echo $_POST['background']; ?>">


This post has been edited by RichardSA: 28 Mar, 2005 - 09:59 AM
User is offlineProfile CardPM

Go to the top of the page

2 Pages V  1 2 >
Fast ReplyReply to this topicStart new topic
Time is now: 11/22/08 01:16PM

Live PHP Help!

PHP Tutorials

Reference Sheets

PHP Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month