Page 1 of 2
data pulled from db
Posted: Tue Jul 24, 2007 2:03 pm
by kippy
When I pull data from a database and place it in a form field (sticky), the text after the first space is cut off. When I display the same data to the page for viewing only, all text is displayed. Can anyone tell me what I am overlooking? Thanks in advance!
Posted: Tue Jul 24, 2007 2:18 pm
by miro_igov
Of course if you do not use quotes for the value attribute it will cut off the words after the space
example <input type="text" value=hello world ----> wrong
example 2 <input type="text" value="hello world" correct
Posted: Tue Jul 24, 2007 2:21 pm
by kippy
I was actually using value=<?php echo $var ?>
Posted: Tue Jul 24, 2007 2:23 pm
by miro_igov
how about changing it to value="<?php echo $var ?>"
Posted: Tue Jul 24, 2007 2:36 pm
by kippy
what about using the same variable in a link, for instance trying to send a title via the header("Location: some link"); I tried to do a $var=urlencode($title); then use the $var in the link, but it is only displaying the forst text up to the first space.
use htmlentities
Posted: Tue Jul 24, 2007 6:58 pm
by yacahuma
I think for security you should use htmlentities
Code: Select all
<input type="text" id="myval" value="<?=htmlentities($dbval)?>" />
Posted: Tue Jul 24, 2007 8:53 pm
by kippy
my problem is i need to have a form on a new page autosubmit (in a sense), is this possible?
basically:
page1.php(form) submits to a second page that calculates data from the first page and submits a form on page2.php automatically, so it appears seamless to the user
possible?
dont need to do that
Posted: Thu Jul 26, 2007 3:18 pm
by yacahuma
I see no reason for having the second page
user enter data on page 1. usre submit data. all processing is done on another page (or it could be the same page) and then just redirect to your final destination
Code: Select all
page1.php
<?
if (isset($_POST['submitbtn'])){
processing here
header("Location: next_url_page");
exit
}
?>
<html>
<head>
<title>Page title</title>
</head>
<body>
<form action="page1.php" method="post">
<input type="submit" name="submitbtn" />
</form>
</body>
</html>
Posted: Thu Jul 26, 2007 3:23 pm
by kippy
thanks but that wont work....i have certain guidlines, etc that I have to follow which will not permit the form to work that way! Thanks though...
on another note any know if the $add variable is the quantity field for paypal(when sending data to paypal)?
Posted: Thu Jul 26, 2007 3:27 pm
by miro_igov
kippy, are you trying to process user input and send him to paypal ?
Posted: Thu Jul 26, 2007 3:40 pm
by kippy
yes, I have everything working fine, except the quantity is only displaying 1 in the pay pal cart....the price shows up properly quantity*price...i am at a loss....
Posted: Thu Jul 26, 2007 3:43 pm
by miro_igov

don't be so weak, how about
Code: Select all
<input type="hidden" name="quantity" value="<?php $qty; ?>">
Posted: Thu Jul 26, 2007 3:59 pm
by kippy
ummm....ok, I am officially retiring after that one! I thought the variable on the paypal site was pulling from another variable $add or $qo....my sincere apologies and I am now going to have the local kids beat me with small tree branches for my stupidity....!
Thanks Miro
Posted: Thu Jul 26, 2007 4:12 pm
by miro_igov
Posted: Thu Jul 26, 2007 4:17 pm
by kippy
Please sir may I have another....!