Hello,
I have a Page which uses a function
to call a product along with it's title and description from a database..PHP Code:function getChosenPhoto($the_selected_id) {
require 'database.php';
$id = $the_selected_id;
$q = "SELECT title, description, src FROM wrappers Where id = $id LIMIT 1";
$result = $mysqli->query($q) or die("there was a problem");
if($result) {
while ($row = $result->fetch_object()) {
echo '<img src="' . $row->src . '" alt="title" /><br />';
echo '<h1 class="smallh1"><b>Title: </b>' . $row->title . '</h1>';
echo '<h1 class="smallh1"><b>Description: </b><span id="description">' . $row->description . '</span></h1>';
}
} else die("There was some problem");
}
I want to be able to call the title on the orderform page which follows afterwards and put it in an input box called title...
I have tried to use the following code to set the value of the input box but with no luck <input type="text" name="title" value="£<?php echo $title; ?>" size="35" />
Any idea how I transfer the variable across to the orderform page?
Code for product view page
Code PHP:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="no" lang="no"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="description" content="description" /> <meta name="keywords" content="chocolate, wrappers, occasions, birthdays, wedding favours, valentines, personalisation, events, party bags, personalised chocolate, chocolate presents, wchocolate wrappers, chocolate bars, corporate" /> <meta name="author" content="author" /> <meta name="robots" content="index, follow" /> <!-- Favico --> <link rel="shortcut icon" type="image/ico" href="/favicon.ico" /> <!-- CSS --> <link rel="stylesheet" href="css/default.css" type="text/css" media="all" /> <style type="text/css" media="screen">@import url(css/facebox.css);</style> <style type="text/css" media="screen">@import url(css/css_messages.css);</style> <script type="text/javascript" src="js/jquery-1.2.6.pack.js"></script> <script type="text/javascript" src="js/jquery.livequery.pack.js"></script> <!-- Document title --> <title>Chocbars.co.uk - Review your wrapper and purchase</title> </head> <body> <!-- Header with logo and search field --> <div id="header"> <!-- Logo, add your on alternative title to the image (Company name) --> <div id="logo"><a href="index.php"><img src="img/logo.png" id="logoimg" alt="Company name" /></a></div> <!-- Add action-url for the search function --> <div id="search"><h1>LOGIN</h1> <form action="" method="post"> <input name="action" type="submit" id="action" value="" /> <label ="username"> <input name="username" type="text" id="field" onfocus="if (this.value == 'Username...') {this.value = '';}" value="Username..." /> </label> <label ="password"> <input name="pwd" type="password" id="field" /> </label> </form> <?php if(isset($response)) echo "<h4 class='alert'>" . $response . "</h4>"; ?> </div> </div> <!-- Sets the width and center the page --> <div id="wrapper"> <!-- Navigation --> <div id="navigation"> <div id="left"></div> <ul class="nav"> <li><a href="index.php" id="left-tab">Home</a></li> <li><a href="#"><b></b><span>Wrappers</span><!--[if IE 7]><!--></a><!--<![endif]--> <!--[if lte IE 6]><table><tr><td><![endif]--><div></div> <ul> <li><a href="birthdays.php">Birthdays</a></li> <li><a href="weddings.php">Weddings</a></li> <li><a href="birth.php">Birth Announcements</a></li> <li><a href="valentines.php">Valentines</a></li> <li><a href="easter.php">Easter</a></li> <li><a href="christmas.php">Christmas</a></li> <li><a href="halloween.php">Halloween</a></li> <li><a href="prom.php">Prom Nights</a></li> <li><a href="fund.php">Fund Raising</a></li> <li><a href="mini.php">- Mini Bar</a></li> </ul> <!--[if lte IE 6]></td></tr></table></a><![endif]--> </li> <li><a href="corporate.php">Photos</a></li> <li><a href="FAQ.php">FAQ</a></li> <li><a href="pricing.php">FAQ</a></li> <li><a href="contact.php" id="right-tab">Contact</a></li> </ul> <div id="right"></div> </div> <div id="main"> <div id="columnleft"> <h2><span class="purple">Wrapper</span> view</h2> <h1>Select Quantity and proceed to order form</h1> <br /> <?php require 'functions.php'; require 'database.php'; getChosenPhoto($_GET['id']); ?> <div id="column1footer"><p align="left"><br /><br /><a href="admin.php">Back</a></p></div> </div> <div id="columnright"> <h1 class="smallh1">Pricing:</h1> <ul> <li><span class="purple">1 - 10 items @ £1.65 - Postage cost = £3.50</span></li> <li><span class="purple">11 - 20 items @ £1.60 - Postage cost = £4.80</span></li> <li><span class="purple">21 - 50 items @ £1.50 - Postage cost = £6.40</span></li> <li><span class="purple">51 - 100 items @ £1.45 - Postage cost = £8.90</span></li> <li><span class="purple">101 - 200 items @ £1.35 - Postage cost = £11.55</span></li> </ul> <div class="line"> </div> <form name="addqty" method="post" action="orderform.php"> <label name="title">Title:</label> <input name="title" type="text" size="20" value="<?php echo $title; ?>" /> <div class="clear"></div> <label name="quantity">Quantity:</label> <input name="qty" type="text" size="5"/> <input type="submit" class="submit" value="Proceed" name="submit" /> </form> </div> <br class="clear" /> </div> <div id="end"> </div> <div id="footer">Copyright © 2008 Created by <a href="http:www.icomcreative.co.uk"><b>icom creative.</b></a> All Rights Reserved.</div> </div> </body> </html>
any help would be great thanks





Bookmarks