data pulled from db

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

kippy
Forum Commoner
Posts: 84
Joined: Wed Jun 07, 2006 8:25 pm

data pulled from db

Post 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!
miro_igov
Forum Contributor
Posts: 485
Joined: Fri Mar 31, 2006 5:06 am
Location: Bulgaria

Post 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
kippy
Forum Commoner
Posts: 84
Joined: Wed Jun 07, 2006 8:25 pm

Post by kippy »

I was actually using value=<?php echo $var ?>
miro_igov
Forum Contributor
Posts: 485
Joined: Fri Mar 31, 2006 5:06 am
Location: Bulgaria

Post by miro_igov »

how about changing it to value="<?php echo $var ?>"
kippy
Forum Commoner
Posts: 84
Joined: Wed Jun 07, 2006 8:25 pm

Post 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.
User avatar
yacahuma
Forum Regular
Posts: 870
Joined: Sun Jul 01, 2007 7:11 am

use htmlentities

Post by yacahuma »

I think for security you should use htmlentities

Code: Select all

<input type="text" id="myval" value="<?=htmlentities($dbval)?>" />
kippy
Forum Commoner
Posts: 84
Joined: Wed Jun 07, 2006 8:25 pm

Post 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?
User avatar
yacahuma
Forum Regular
Posts: 870
Joined: Sun Jul 01, 2007 7:11 am

dont need to do that

Post 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>
kippy
Forum Commoner
Posts: 84
Joined: Wed Jun 07, 2006 8:25 pm

Post 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)?
miro_igov
Forum Contributor
Posts: 485
Joined: Fri Mar 31, 2006 5:06 am
Location: Bulgaria

Post by miro_igov »

kippy, are you trying to process user input and send him to paypal ?
kippy
Forum Commoner
Posts: 84
Joined: Wed Jun 07, 2006 8:25 pm

Post 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....
miro_igov
Forum Contributor
Posts: 485
Joined: Fri Mar 31, 2006 5:06 am
Location: Bulgaria

Post by miro_igov »

:( don't be so weak, how about

Code: Select all

<input type="hidden" name="quantity" value="<?php $qty; ?>">
kippy
Forum Commoner
Posts: 84
Joined: Wed Jun 07, 2006 8:25 pm

Post 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
miro_igov
Forum Contributor
Posts: 485
Joined: Fri Mar 31, 2006 5:06 am
Location: Bulgaria

Post by miro_igov »

Image
kippy
Forum Commoner
Posts: 84
Joined: Wed Jun 07, 2006 8:25 pm

Post by kippy »

Please sir may I have another....!
Post Reply