Jump to content

Post keeps adding ''


smproph

Recommended Posts

Right now I have a search option on my site that searches the database for whatever the user puts in. Well then they can click on a record and they can edit it. What I am trying to accomplish is whenever a user clicks to edit but then decides that was the wrong record they can hit a back button and it will show them their results with what they typed in earlier. If they just click the back button on top they get a "Do you want to resubmit the form".

I tried the

<a href="#" onclick="history.go(-1);return false;" class="mtn">

Find out that only works on Safari and that isn't good code.

Then I tried this...

<input type="hidden" name="qry" value="<?=$qry_str?>">

 

$qry_str is my "SELECT" statement and I am just sending it to my update page as a variable with the POST.

 

On my update page I pull the variable, save it in another one and send it back to the search page if the user clicks the back link. However it keeps adding a '' on both sides of the criteria everytime I send it to a page.

 

For instance, I have: SELECT * FROM tasks WHERE 1 and Owner='cnj'. Then I echo on my update page and its SELECT * FROM tasks WHERE 1 and Owner=''cnj'', then I click the back link and get this: SELECT * FROM tasks WHERE 1 and Owner=''''cnj''''. It is doubling them up everytime.

 

Code on the update page looks like this if you wanted to see

<?php $search=$_POST['qry'];?>
<FORM name="form1" action="searchtasks.php" method="post">
<input type="hidden" name="return" value="<?=$search?>"></FORM>
<a href="javascript: submitform()">Back</a>

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.