#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Posts
    4
    Rep Power
    0
    Please help urgently.
    I have a scenario like the one below and can't figure out how to get around it

    <?
    $field1 = "Push the button"
    PRINT "<INPUT type=text name=push value=$field1>";
    ?>
    This is from a form. When i submit the form the field $field1 only seems to contain the value "Push" and the " the button" is missing.
    Can anyone tell me how to resolve this problem. This is happening with all the string values whereby spaces are present.


  2. #2
  3. .Net Developer
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2000
    Location
    London
    Posts
    987
    Rep Power
    15

    <?
    $field1 = "Push the button"
    PRINT "<INPUT type=text name=push value=$field1>";
    ?>



    In this case you can use a urlencode() function in your first page...

    you should decode that value before print it .

    <?
    $field1 = "Push the button"
    $field1=urlencode($field1);
    ?>


    <?
    $field1=urldecode($field1);
    $field1=stripslashes($field1);

    echo "<INPUT type="text" name="push" value=".$field1.">";
    ?>


    ------------------
    SR -
    webshiju.com

    "The fear of the LORD is the beginning of knowledge..."

    [This message has been edited by Shiju Rajan (edited July 06, 2000).]
  4. #3
  5. No Profile Picture
    Robert_J_Sherman
    Guest
    Devshed Newbie (0 - 499 posts)
    <BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">quote:</font><HR>Originally posted by victha:
    Please help urgently.
    I have a scenario like the one below and can't figure out how to get around it

    <?
    $field1 = "Push the button"
    PRINT "<INPUT type=text name=push value=$field1>";
    ?>
    This is from a form. When i submit the form the field $field1 only seems to contain the value "Push" and the " the button" is missing.
    Can anyone tell me how to resolve this problem. This is happening with all the string values whereby spaces are present.

    [/quote]

    You might also try:
    <?php
    $field1 = "Push the Button";
    ?>
    <input type="text" name="push" value="<?php echo $field1; ?>">

    I've never experienced the problem you've described, and I user the example quite often.

    I've urlencoded a few things, like email subjects etc, or if I'm passing an item via a get statement, whereby it's becoming a link, therefore the urlencode is quite essential.

    don't forget to urldecode() the string when you write back to the document.

    ------------------
    SnR Graphics,
    Low Cost Hosting and Web Development.

Similar Threads

  1. permissions after uploading
    By Paul Niessen in forum Perl Programming
    Replies: 3
    Last Post: February 15th, 2004, 05:51 PM
  2. Help with HTML Parsing
    By musashiBRS in forum Python Programming
    Replies: 6
    Last Post: February 13th, 2004, 02:32 AM
  3. Writing to two *.csv files
    By CAR in forum Perl Programming
    Replies: 4
    Last Post: February 7th, 2004, 04:39 PM
  4. Help with script
    By akastarlight in forum Perl Programming
    Replies: 1
    Last Post: February 6th, 2004, 06:55 AM
  5. need help with testing non-alphanumeric input
    By pinkipodmini in forum PHP Development
    Replies: 1
    Last Post: January 23rd, 2004, 01:48 PM

IMN logo majestic logo threadwatch logo seochat tools logo