how to put the option value in paypal provide form?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
laura
Forum Newbie
Posts: 19
Joined: Wed May 17, 2006 1:06 pm

how to put the option value in paypal provide form?

Post by laura »

hi,there.
i have made this simple shoes web store so that ppl if like this shoes,they can buy it and pay by paypal.
the problem is i dunno how to put the value in the form that paypal provided.

the shoes got sizes.if the buyer after seeing the shoes and they like it,they can select the sizes and then click on the paypal button and then they will directed to paypal.
but the shoes sizes is not appear.cos i dunno what name should i put in the name tag and the value tag.
could anyone who knows this help me out?
thanks in advance and really appreaciate it ^^v

i included the codes as well ^^v problem is at the bottom there
thanks!!!!!

Code: Select all

<html>
<head>
<title>livestock-brand-display</title>
</head>
<style>
	a
	{
	text-decoration:none;
	}
</style>
<body>
<table align="center" width="750" height="455" border="1" cellpadding="0" cellspacing="0">
<tr>
	<td valign="top" colspan="3" height="90"><img src="images/logo.gif"></td>
	<td valign="top" align="right" colspan="3">address</td>
					
</tr>
<tr>
	<td height="20" width="125"><a href="home.php"><font size="-4">home</font></a></td>
	<td width="125">
	<?php 
	include "IncludeFiles/db_config.php";
	$myConn=mysql_connect($host,$uname,$pword);
	$mydb=mysql_select_db($dbname,$myConn);
	$sql="select * from categories";
	$rs=mysql_query($sql,$myConn);
	$num_rows=mysql_num_rows($rs);
	for($i=1;$i<=$num_rows;$i++)
	{
	$row=mysql_fetch_array($rs);
	echo "<font size=-4>";
	echo "<a href='brands.php?cid=".$row['categoryid']."'>";
	echo $row['cname']; 
	echo "</a>";
	echo "</font>";
	}
	?>
	</td>
	<td width="125">&nbsp;</td>
	<td width="125">&nbsp;</td>
	<td width="125">&nbsp;</td>
	<td width="125">&nbsp;</td>
</tr>
<tr>
	<td align="center" colspan="6" height="330">
	<a href="brands.php">back to choose brands</a><br>
	<a href="bproducts.php">back to choose choices</a><br>
	<?php 
	$sql22="select m.productid,m.pname,m.pimg,m.pdetail,m.pcolor,m.pprice,m.psize1,m.psize2,m.psize3,m.psize4,m.psize5,c.bname from products as m inner join brands as c on c.brandid=m.brandid where productid=".$_GET["cat"];
	$rs=mysql_query($sql22,$myConn);
	$num_rows=mysql_num_rows($rs);
echo "<table border=1>";
	for($i=1;$i<=$num_rows;$i++)
	{
	$row=mysql_fetch_array($rs);
	echo "<tr>";
	echo "<td rowspan='6'>";
	echo "<img src='images/products/".$row["bname"]."/".$row["pimg"]."' height=200 width=210>";
	echo "</td>";
	echo "</tr>";
	echo "<tr>";
	echo "<td>";
	echo "name : ";
	echo "<font face=verdana size=+1>".$row["pname"]."</font>";
	echo "</td>";
	echo "</tr>";
	echo "<tr>";
	echo "<td>";
	echo "price : ";
	echo $row["pprice"]; echo "<br>";
	echo "</td>";
	echo "</tr>";
	echo "<tr>";
	echo "<td>";
	echo "color : ";
	echo $row["pcolor"]; echo "<br>";
	echo "</td>";
	echo "</tr>";
	echo "<tr>";
	echo "<td>";
	echo "detail : ";
	echo $row["pdetail"];echo "<br>";
	echo "</td>";
	echo "</tr>";
	echo "<tr>";
	echo "<td>";
	echo "sizes : ";
	echo "<select name='num'>";
	echo "<option value='".$row["psize1"]."'>".$row["psize1"]."</option>";
	echo "<option value='".$row["psize2"]."'>".$row["psize2"]."</option>";
	echo "<option value='".$row["psize3"]."'>".$row["psize3"]."</option>";
	echo "<option value='".$row["psize4"]."'>".$row["psize4"]."</option>";
	echo "<option value='".$row["psize5"]."'>".$row["psize5"]."</option>";
	echo "</select>";
	echo "</td>";
	echo "</tr>";
	}
echo "</table>";	
	
echo "<form action='https://www.paypal.com/cgi-bin/webscr' method='post'>";
echo "<input type='hidden' name='cmd' value='_xclick'>";
echo "<input type='hidden' name='business' value='nanakooy@hotmail.com'>";
echo "<input type='hidden' name='item_name' value='".$row["pname"]."'>";
echo "<input type='hidden' name='' value=''>";// how to make the option selected to put here?what to put in the name and the value?
echo "<input type='hidden' name='currency_code' value='USD'>";
echo "<input type='hidden' name='amount' value='".$row["pprice"]."'>";
echo "<input type='hidden' name='shipping' value='$15'>";
echo "<input type='hidden' name='no_shipping' value='0'>";//will this one ask for the buyers address?
echo "<input type='hidden' name='cancel_return' value='http://www.bodwellinternet.com/<span style='color:blue' title='I&#39;m naughty, are you naughty?'>smurf</span>/vancafe'>";
echo "<input type='hidden' name='return' value='http://www.abc.com'>";//will this one return to my site after buyers checking out?
echo "<input type='image' src='http://www.paypal.com/en_US/i/btn/x-click-but01.gif' name='submit'>";
//how to display these $row["pcolor"] , $row["pdetail"] in paypal too?
mysql_close($myConn);
?>
	</td>
</tr>
<tr>
	<td align="center" colspan="6" height="15"></td>
</tr>
</table>
</body>
</html>
User avatar
laura
Forum Newbie
Posts: 19
Joined: Wed May 17, 2006 1:06 pm

Post by laura »

hi ^^v
could anyone help me out with this?
thank you very much^^v
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

Not sure what you are asking. Are you asking what piece of data from your script needs to be passed to the Paypal API, or are you asking how to get a know piece of data from the script into that hidden form element?
User avatar
laura
Forum Newbie
Posts: 19
Joined: Wed May 17, 2006 1:06 pm

Post by laura »

thanks for the reply!!!!!appreciate it!

Code: Select all

echo "<form action='https://www.paypal.com/cgi-bin/webscr' method='post'>"; 
echo "<input type='hidden' name='cmd' value='_xclick'>"; 
echo "<input type='hidden' name='business' value='nanakooy@hotmail.com'>"; 
echo "<input type='hidden' name='item_name' value='".$row["pname"]."'>"; 
echo "<input type='hidden' name='currency_code' value='USD'>"; 
echo "<input type='hidden' name='amount' value='".$row["pprice"]."'>"; 
echo "<input type='hidden' name='shipping' value='$15'>"; 
echo "<input type='hidden' name='cancel_return' value='http://www.bodwellinternet.com/smurf/vancafe'>"; 
echo "<input type='hidden' name='return' value='http://www.abc.com'>";
echo "<input type='hidden' name='no_shipping' value='0'>";//will this one ask for the buyers address? 
echo "<input type='hidden' name='' value=''>";// how to make the option selected to put here?what to put in the name and the value?
echo "<input type='image' src='http://www.paypal.com/en_US/i/btn/x-click-but01.gif' name='submit'>";
echo "</form>";
what i want to know is what should i put here :
<input type='hidden' name='i dunno what to put here' value='i dunno what to put here cos the users might select $row["psize1"],$row["psize2"],$row["psize3"],$row["psize4"] or $row["psize5"]'> (this is for shoe sizes the users will select)
another one is <input type=hidden' name='i dunno what to put here' value='".$row["pcolor"]."'>

i hope who helps me could understd what i am trying to say here.thanks in advance!!!!
if need the whole files n database pls let me know.i will put here^^
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

I am not intimately familiar with the Paypal API, but I would guess that those fields, if not used by Paypal, are probably going to be returned to your script so you know what the user actually ordered (Item ID, type, color, size, etc). I am not sure if Paypal needs this information or it will take it and process it back to your script on the return.
Post Reply